feat: use last community in community form

This commit is contained in:
Xyphyn committed 2023-08-08 15:21:25 -07:00
1 parent d22d9b09fd
commit 6c7073fcfc
6 files changed
+70 -10

No files matched your search

+25
View File
@@ -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)!)
}