diff options
author | Indrajith K L | 2019-12-11 18:54:05 +0530 |
---|---|---|
committer | Indrajith K L | 2019-12-11 18:54:05 +0530 |
commit | 8988233da897e8447a1dbdb700836fb8576e5e6b (patch) | |
tree | 0bcaaf9657f35320ea110085ed0c40f815100a55 /src/services | |
parent | 53e5edb3d93d957f82034be43940d560540525a8 (diff) | |
download | react-redux-saga-starter-8988233da897e8447a1dbdb700836fb8576e5e6b.tar.gz react-redux-saga-starter-8988233da897e8447a1dbdb700836fb8576e5e6b.tar.bz2 react-redux-saga-starter-8988233da897e8447a1dbdb700836fb8576e5e6b.zip |
:tada: Initial Commit
Diffstat (limited to 'src/services')
-rw-r--r-- | src/services/http.service.js | 0 | ||||
-rw-r--r-- | src/services/storage.service.js | 16 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/services/http.service.js b/src/services/http.service.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/services/http.service.js diff --git a/src/services/storage.service.js b/src/services/storage.service.js new file mode 100644 index 0000000..c41d552 --- /dev/null +++ b/src/services/storage.service.js @@ -0,0 +1,16 @@ +class Storage{ + static get = (key)=>{ + if(!key)throw("Storage.get expects a 'key' - 'key' can't be null"); + if(!localStorage.getItem(key)) return null; + return localStorage.getItem(key); + } + + static set = (key, value)=>{ + if(!key||!value){ + throw("Storag.set expects a 'key' and a 'value' - 'value' & 'key' can't be null"); + } + localStorage.setItem(key, JSON.stringify(value)); + } +} + +export default Storage;
\ No newline at end of file |