feat: use last community in community form
This commit is contained in:
1 parent
d22d9b09fd
commit
6c7073fcfc
6 files changed
+70
-10
No files matched your search
@@ -0,0 +1,25 @@
|
||||
interface SessionStorage {
|
||||
lastSeenCommunity: // prettier-ignore
|
||||
{
|
||||
id: number
|
||||
name: string
|
||||
} | undefined
|
||||
postData: {}
|
||||
}
|
||||
|
||||
export const setSessionStorage = (
|
||||
key: keyof SessionStorage,
|
||||
value: SessionStorage[typeof key]
|
||||
) => {
|
||||
if (value == undefined) {
|
||||
sessionStorage.removeItem(key)
|
||||
} else {
|
||||
sessionStorage.setItem(key, JSON.stringify(value))
|
||||
}
|
||||
}
|
||||
|
||||
export const getSessionStorage = (
|
||||
key: keyof SessionStorage
|
||||
): SessionStorage[typeof key] => {
|
||||
return JSON.parse(sessionStorage.getItem(key)!)
|
||||
}
|
||||
Reference in new issue
Block a user