Rollback server side set cookie

This commit is contained in:
2024-08-13 00:52:48 +08:00
parent 1130e6a574
commit 14f2bc0ee6
4 changed files with 12 additions and 6 deletions

View File

@ -17,6 +17,15 @@ export function useAtk() {
return useCookie("__hydrogen_atk", { watch: "shallow" })
}
export function useRtk() {
return useCookie("__hydrogen_rtk", { watch: "shallow" })
}
export function setTokenSet(atk: string, rtk: string) {
useAtk().value = atk
useRtk().value = rtk
}
export function useLoggedInState() {
return computed(() => useAtk().value != null)
}
@ -34,7 +43,6 @@ export const useUserinfo = defineStore("userinfo", () => {
const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/users/me`, {
headers: { Authorization: `Bearer ${useAtk().value}` },
credentials: "include",
})
if (res.status !== 200) {