Skip to content

Commit 15bdfd8

Browse files
committed
fix(cache): evict user cache on logout
1 parent 9078743 commit 15bdfd8

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"release:changelog": "extract-changelog-release > RELEASE.md"
5252
},
5353
"dependencies": {
54-
"@dvcol/base-http-client": "^1.13.1",
54+
"@dvcol/base-http-client": "^1.14.0",
5555
"@dvcol/common-utils": "^1.11.2",
5656
"@dvcol/simkl-http-client": "^1.1.2",
5757
"@dvcol/tmdb-http-client": "^1.3.4",

pnpm-lock.yaml

+3-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/services/trakt.service.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ export class TraktService {
206206
static async logout(account?: string) {
207207
await useAuthSettingsStore().setAuth(undefined, account);
208208
await useUserSettingsStore().setUserSetting(undefined, account);
209+
this.evict.trakt().catch(err => Logger.error('Failed to evict trakt cache', err));
209210
return this.traktClient.importAuthentication({});
210211
}
211212

@@ -631,6 +632,7 @@ export class TraktService {
631632
logout: async (account?: string) => {
632633
await useAuthSettingsStore().setAuth({ simkl: null }, account);
633634
await useSimklStore().setUserSetting(undefined, account);
635+
this.evict.simkl().catch(err => Logger.error('Failed to evict simkl cache', { account, err }));
634636
return this.simklClient.importAuthentication({});
635637
},
636638
show: async (id: string | number, extended = true) => {
@@ -654,9 +656,9 @@ export class TraktService {
654656
};
655657

656658
static evict = {
657-
tmdb: () => TraktService.tmdbClient.clearCache(),
658-
trakt: () => TraktService.traktClient.clearCache(),
659-
simkl: () => TraktService.simklClient.clearCache(),
659+
tmdb: async () => TraktService.tmdbClient.clearCache(),
660+
trakt: async () => TraktService.traktClient.clearCache(),
661+
simkl: async () => TraktService.simklClient.clearCache(),
660662
images: () =>
661663
Promise.all([
662664
TraktService.tmdbClient.v3.configuration.details.cached.evict(),

0 commit comments

Comments
 (0)