localization v2
This commit is contained in:
@@ -49,5 +49,15 @@ export const actions: Actions = {
|
||||
} else {
|
||||
return redirect(302, '/');
|
||||
}
|
||||
},
|
||||
setLocale: async ({ url, cookies }) => {
|
||||
const locale = url.searchParams.get('locale');
|
||||
// change the theme only if it is one of the allowed themes
|
||||
if (locale && ['en', 'es'].includes(locale)) {
|
||||
cookies.set('locale', locale, {
|
||||
path: '/',
|
||||
maxAge: 60 * 60 * 24 * 365
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user