diff options
author | 2018-02-15 17:38:13 +0100 | |
---|---|---|
committer | 2018-02-15 17:38:13 +0100 | |
commit | 9a89ef51cded72d5e6d378211e8a74964cfc8cc2 (patch) | |
tree | ee4c0d7913119d52b266f66f46d99ee9ef3b9ed8 /src/api | |
parent | replace localStorage with mobx-localstorage (diff) | |
download | ferdium-app-9a89ef51cded72d5e6d378211e8a74964cfc8cc2.tar.gz ferdium-app-9a89ef51cded72d5e6d378211e8a74964cfc8cc2.tar.zst ferdium-app-9a89ef51cded72d5e6d378211e8a74964cfc8cc2.zip |
Replace localAPI requests with mobx-localstorage
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/server/LocalApi.js | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/api/server/LocalApi.js b/src/api/server/LocalApi.js index efbb42999..1988f713c 100644 --- a/src/api/server/LocalApi.js +++ b/src/api/server/LocalApi.js | |||
@@ -7,38 +7,6 @@ import { getServicePartitionsDirectory } from '../../helpers/service-helpers.js' | |||
7 | const { session } = remote; | 7 | const { session } = remote; |
8 | 8 | ||
9 | export default class LocalApi { | 9 | export default class LocalApi { |
10 | // App | ||
11 | async updateAppSettings(data) { | ||
12 | const currentSettings = await this.getAppSettings(); | ||
13 | const settings = Object.assign(currentSettings, data); | ||
14 | |||
15 | localStorage.setItem('app', JSON.stringify(settings)); | ||
16 | console.debug('LocalApi::updateAppSettings resolves', settings); | ||
17 | |||
18 | return settings; | ||
19 | } | ||
20 | |||
21 | async getAppSettings() { | ||
22 | const settingsString = localStorage.getItem('app'); | ||
23 | try { | ||
24 | const settings = JSON.parse(settingsString) || {}; | ||
25 | console.debug('LocalApi::getAppSettings resolves', settings); | ||
26 | |||
27 | return settings; | ||
28 | } catch (err) { | ||
29 | return {}; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | async removeKey(key) { | ||
34 | const settings = await this.getAppSettings(); | ||
35 | |||
36 | if (Object.hasOwnProperty.call(settings, key)) { | ||
37 | delete settings[key]; | ||
38 | localStorage.setItem('app', JSON.stringify(settings)); | ||
39 | } | ||
40 | } | ||
41 | |||
42 | // Services | 10 | // Services |
43 | async getAppCacheSize() { | 11 | async getAppCacheSize() { |
44 | const partitionsDir = getServicePartitionsDirectory(); | 12 | const partitionsDir = getServicePartitionsDirectory(); |