JSFiddle - React, Tailwind, and code Playground

by ronilan

JavaScript

// storage class
function Storage(){
    
}

Storage.prototype.store = function(json, storageName){
    localStorage.setItem(storageName, JSON.stringify(json))
}

Storage.prototype.remove = function(storageName){
    localStorage.removeItem(storageName);
}

Storage.prototype.retrive = function(storageName){
    var json = localStorage.getItem(storageName);
    return JSON.parse(json);
}

console.clear();
storage = new Storage();

json = {
        "account_id" : null,
        "email" : null,
        "request_email" : null,
        "app_token" : null
      };

storage.store(json, "account");
console.log(storage.retrive("account"));