You have learned two ways to store data in the browser and use them as a replacement for a RESTful API server. The localStorage method has a simple API and it is widely supported for all major browsers; this is going to be your first choice if you want support old browsers; however, it has the limitation that you can only store five megabytes.
IndexedDB is powerful; however, its API is more complicated than localStorage. You need to learn some concepts before you start working with it. Once you know how it works, you should write your app asynchronously.