This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2021-10-13 19:53:39 +00:00
|
|
|
const LAST_VISITED_KEY = 'lastVisited'
|
|
|
|
|
2023-08-24 10:15:45 +00:00
|
|
|
export const saveLastVisited = (name: string | undefined, params: object, query: object) => {
|
|
|
|
if (typeof name === 'undefined') {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-10-23 11:12:04 +00:00
|
|
|
localStorage.setItem(LAST_VISITED_KEY, JSON.stringify({name, params, query}))
|
2021-10-13 19:53:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const getLastVisited = () => {
|
|
|
|
const lastVisited = localStorage.getItem(LAST_VISITED_KEY)
|
|
|
|
if (lastVisited === null) {
|
|
|
|
return null
|
|
|
|
}
|
2023-08-24 10:15:45 +00:00
|
|
|
|
2021-10-13 19:53:39 +00:00
|
|
|
return JSON.parse(lastVisited)
|
|
|
|
}
|
|
|
|
|
|
|
|
export const clearLastVisited = () => {
|
|
|
|
return localStorage.removeItem(LAST_VISITED_KEY)
|
|
|
|
}
|