2 Commits

Author SHA1 Message Date
3d185bf044 chore(release): 1.2.1 [skip ci] 2022-08-30 16:47:03 +00:00
6cfee0f6a3 fix: cache with outdated data 2022-08-30 18:42:21 +02:00
6 changed files with 14 additions and 14 deletions

1
.gitignore vendored
View File

@ -49,3 +49,4 @@ npm-debug.log*
.DS_Store
.lighthouseci
.vercel
*.hbs

View File

@ -1,7 +0,0 @@
.next
.lighthouseci
coverage
node_modules
**/workbox-*.js
**/sw.js
*.hbs

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@thream/website",
"version": "1.2.0",
"version": "1.2.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@thream/website",
"version": "1.2.0",
"version": "1.2.1",
"hasInstallScript": true,
"dependencies": {
"@fontsource/montserrat": "4.5.12",

View File

@ -1,6 +1,6 @@
{
"name": "@thream/website",
"version": "1.2.0",
"version": "1.2.1",
"private": true,
"repository": {
"type": "git",
@ -20,7 +20,7 @@
"lint:editorconfig": "editorconfig-checker",
"lint:markdown": "markdownlint-cli2",
"lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
"lint:prettier": "prettier \".\" --check",
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
"lint:staged": "lint-staged",
"test:unit": "cypress run --component",
"test:html-w3c-validator": "start-server-and-test \"start\" \"http://localhost:3000\" \"html-w3c-validator\"",

View File

@ -5,6 +5,7 @@ import { API_URL } from '../api'
import { cookies } from '../cookies'
import { Tokens } from '.'
import { fetchRefreshToken } from './authenticationFromServerSide'
import { clearCache } from '../cache'
export class Authentication {
public tokens: Tokens
@ -99,7 +100,7 @@ export class Authentication {
public signout(): void {
cookies.remove('refreshToken')
window.localStorage.clear()
clearCache()
window.location.href = '/authentication/signin'
}
@ -120,6 +121,7 @@ export class Authentication {
}
public signin(): void {
clearCache()
cookies.set('refreshToken', this.tokens.refreshToken)
}
}

View File

@ -14,7 +14,7 @@ export type CacheKey =
export const getPaginationCache = <T extends PaginationItem>(
key: CacheKey
): T[] => {
const cache = localStorage.getItem(key)
const cache = sessionStorage.getItem(key)
if (cache != null) {
try {
const data = JSON.parse(cache)
@ -30,5 +30,9 @@ export const savePaginationCache = <T extends PaginationItem>(
key: CacheKey,
data: T[]
): void => {
localStorage.setItem(key, JSON.stringify(data))
sessionStorage.setItem(key, JSON.stringify(data))
}
export const clearCache = (): void => {
sessionStorage.clear()
}