Merge branch 'main' into vue3
This commit is contained in:
commit
8e1ab8e09b
16 changed files with 126 additions and 80 deletions
18
src/helpers/saveLastVisited.ts
Normal file
18
src/helpers/saveLastVisited.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
const LAST_VISITED_KEY = 'lastVisited'
|
||||
|
||||
export const saveLastVisited = (name: string, params: object) => {
|
||||
localStorage.setItem(LAST_VISITED_KEY, JSON.stringify({name, params}))
|
||||
}
|
||||
|
||||
export const getLastVisited = () => {
|
||||
const lastVisited = localStorage.getItem(LAST_VISITED_KEY)
|
||||
if (lastVisited === null) {
|
||||
return null
|
||||
}
|
||||
|
||||
return JSON.parse(lastVisited)
|
||||
}
|
||||
|
||||
export const clearLastVisited = () => {
|
||||
return localStorage.removeItem(LAST_VISITED_KEY)
|
||||
}
|
||||
Reference in a new issue