mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-10 14:06:10 +00:00
review comments for storage
This commit is contained in:
parent
0b16b028b4
commit
5e1d60882d
@ -1,18 +1,18 @@
|
||||
export function postCurrentFile(file) {
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
localStorage.setItem('currentFile', JSON.stringify(file));
|
||||
resolve({response: {data: file}});
|
||||
});
|
||||
}
|
||||
|
||||
export function fetchCurrentFile() {
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
resolve({response: {data: JSON.parse(localStorage.getItem('currentFile'))}});
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteCurrentFile() {
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
localStorage.removeItem('currentFile');
|
||||
resolve({});
|
||||
});
|
||||
@ -20,35 +20,33 @@ export function deleteCurrentFile() {
|
||||
|
||||
export function saveCredentials({token, host}) {
|
||||
const credentials = {token, host};
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
localStorage.setItem('credentials', JSON.stringify(credentials));
|
||||
resolve({response: {data: credentials}});
|
||||
});
|
||||
}
|
||||
|
||||
export function fetchCredentials() {
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
const credentials = localStorage.getItem('credentials');
|
||||
resolve({response: {data: JSON.parse(credentials)}});
|
||||
});
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
localStorage.clear();
|
||||
resolve({response: true});
|
||||
});
|
||||
}
|
||||
|
||||
export function changeTheme({theme}) {
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
localStorage.setItem('theme', theme);
|
||||
resolve({response: {data: theme}});
|
||||
});
|
||||
}
|
||||
|
||||
export function fetchTheme() {
|
||||
return new Promise(function(resolve) {
|
||||
resolve({response: {data: localStorage.getItem('theme')}});
|
||||
});
|
||||
return new Promise(resolve => resolve({response: {data: localStorage.getItem('theme')}}));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user