diff options
author | 2017-12-29 01:31:52 -0500 | |
---|---|---|
committer | 2017-12-29 01:31:52 -0500 | |
commit | 9e2a998cccee808d8f2f16d4dc6f45d3c069ec32 (patch) | |
tree | 8e87439eec28d47d4f4c7312d0f0da45e38de87b /src/api | |
parent | Log event on second instnace of Franz (diff) | |
download | ferdium-app-9e2a998cccee808d8f2f16d4dc6f45d3c069ec32.tar.gz ferdium-app-9e2a998cccee808d8f2f16d4dc6f45d3c069ec32.tar.zst ferdium-app-9e2a998cccee808d8f2f16d4dc6f45d3c069ec32.zip |
Add button to clear service cache
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/LocalApi.js | 4 | ||||
-rw-r--r-- | src/api/ServicesApi.js | 7 | ||||
-rw-r--r-- | src/api/server/LocalApi.js | 11 |
3 files changed, 21 insertions, 1 deletions
diff --git a/src/api/LocalApi.js b/src/api/LocalApi.js index 6f2b049d6..d52e9cd10 100644 --- a/src/api/LocalApi.js +++ b/src/api/LocalApi.js | |||
@@ -15,4 +15,8 @@ export default class LocalApi { | |||
15 | removeKey(key) { | 15 | removeKey(key) { |
16 | return this.local.removeKey(key); | 16 | return this.local.removeKey(key); |
17 | } | 17 | } |
18 | |||
19 | clearAppCache() { | ||
20 | return this.local.clearAppCache(); | ||
21 | } | ||
18 | } | 22 | } |
diff --git a/src/api/ServicesApi.js b/src/api/ServicesApi.js index 3cb40ba0d..36ed9482f 100644 --- a/src/api/ServicesApi.js +++ b/src/api/ServicesApi.js | |||
@@ -1,5 +1,6 @@ | |||
1 | export default class ServicesApi { | 1 | export default class ServicesApi { |
2 | constructor(server) { | 2 | constructor(server, local) { |
3 | this.local = local; | ||
3 | this.server = server; | 4 | this.server = server; |
4 | } | 5 | } |
5 | 6 | ||
@@ -30,4 +31,8 @@ export default class ServicesApi { | |||
30 | reorder(data) { | 31 | reorder(data) { |
31 | return this.server.reorderService(data); | 32 | return this.server.reorderService(data); |
32 | } | 33 | } |
34 | |||
35 | clearCache(serviceId) { | ||
36 | return this.local.clearCache(serviceId); | ||
37 | } | ||
33 | } | 38 | } |
diff --git a/src/api/server/LocalApi.js b/src/api/server/LocalApi.js index 79ac6e12f..fec89f948 100644 --- a/src/api/server/LocalApi.js +++ b/src/api/server/LocalApi.js | |||
@@ -1,3 +1,7 @@ | |||
1 | import { remote } from 'electron'; | ||
2 | |||
3 | const { session } = remote; | ||
4 | |||
1 | export default class LocalApi { | 5 | export default class LocalApi { |
2 | // App | 6 | // App |
3 | async updateAppSettings(data) { | 7 | async updateAppSettings(data) { |
@@ -30,4 +34,11 @@ export default class LocalApi { | |||
30 | localStorage.setItem('app', JSON.stringify(settings)); | 34 | localStorage.setItem('app', JSON.stringify(settings)); |
31 | } | 35 | } |
32 | } | 36 | } |
37 | |||
38 | // Services | ||
39 | async clearCache(serviceId) { | ||
40 | console.debug(`Clearing cache for persist:service-${serviceId}`); | ||
41 | const s = session.fromPartition(`persist:service-${serviceId}`); | ||
42 | await new Promise(resolve => s.clearCache(resolve)); | ||
43 | } | ||
33 | } | 44 | } |