mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 22:06:29 +02:00
Remove localStorage support because it breaks ssr
This commit is contained in:
@@ -3,24 +3,18 @@ import Cookies from "js-cookie"
|
||||
|
||||
import { VolunteerLogin } from "./volunteers"
|
||||
|
||||
const storage: any = localStorage
|
||||
|
||||
export const axiosConfig: AxiosRequestConfig = {
|
||||
headers: {},
|
||||
}
|
||||
|
||||
export function setJWT(token: string, id: number): void {
|
||||
axiosConfig.headers.Authorization = `Bearer ${token}`
|
||||
storage?.setItem("jwt", token)
|
||||
storage?.setItem("id", id)
|
||||
Cookies.set("jwt", token, { expires: 3650 })
|
||||
Cookies.set("id", `${id}`, { expires: 3650 })
|
||||
}
|
||||
|
||||
export function unsetJWT(): void {
|
||||
delete axiosConfig.headers.Authorization
|
||||
storage?.removeItem("jwt")
|
||||
storage?.removeItem("id")
|
||||
|
||||
Cookies.remove("jwt")
|
||||
Cookies.remove("id")
|
||||
|
Reference in New Issue
Block a user