Files
modrinth/apps/frontend/src/composables/auth-cookie.ts
T
Prospector b68a199814 menu refactor + web account switcher (#7307)
* add account switcher, migrate context menus to overflow menu system, update version filter controls, only pad instance icons

* app account switcher, improve some context menus, theme stuff

* prepr

* handle reauthentication

* fix a couple sign in issues, admin page cleanup, fix org status badges, fix official account badge, open in local keybind, publish plus icons

* rename generic menus to ButtonMenu (& types)

* fix hydration issue w/ dropdowns + middleware error
2026-08-27 00:35:34 +00:00

20 lines
432 B
TypeScript

import type { CookieOptions } from '#app'
const AUTH_COOKIE_NAME = 'auth-token'
const AUTH_COOKIE_OPTIONS = {
maxAge: 60 * 60 * 24 * 365 * 10,
sameSite: 'lax',
httpOnly: false,
path: '/',
} satisfies CookieOptions<string | null>
export const useAuthCookie = () => {
const config = useRuntimeConfig()
return useCookie<string | null>(AUTH_COOKIE_NAME, {
...AUTH_COOKIE_OPTIONS,
secure: config.public.cookieSecure,
})
}