You've already forked AstralRinth
forked from didirus/AstralRinth
Fix authentication hydration issue (#1048)
* Fix authentication hydration issue * reset existing cookies * Update if statement chaining
This commit is contained in:
@@ -9,5 +9,26 @@ export default defineNitroPlugin((nitroApp) => {
|
||||
} else {
|
||||
html.htmlAttrs.push(`class="dark-mode"`)
|
||||
}
|
||||
|
||||
// Reset cookie attributes to correct ones
|
||||
if (cookies) {
|
||||
const opts = {
|
||||
maxAge: 60 * 60 * 24 * 365 * 10,
|
||||
sameSite: 'lax',
|
||||
secure: true,
|
||||
httpOnly: false,
|
||||
path: '/',
|
||||
}
|
||||
|
||||
if (cookies['auth-token']) {
|
||||
setCookie(event, 'auth-token', cookies['auth-token'], opts)
|
||||
}
|
||||
if (cookies['color-mode']) {
|
||||
setCookie(event, 'color-mode', cookies['color-mode'], opts)
|
||||
}
|
||||
if (cookies.cosmetics) {
|
||||
setCookie(event, 'cosmetics', cookies.cosmetics, opts)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user