feat(WEB-132): add middlewares, support for seamless login and improve lang based routes
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* @file Due to these records being used in next.config.js, and that is required
|
||||
* to be a js file, we use jsdoc to type these.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('@/constants/languages').Lang} Lang
|
||||
*/
|
||||
|
||||
/** @type {Record.<Lang, string>} */
|
||||
export const pageNames = {
|
||||
da: "mine-sider",
|
||||
de: "mein-profil",
|
||||
en: "my-pages",
|
||||
fi: "minun-sivujani",
|
||||
no: "mine-sider",
|
||||
sv: "mina-sidor",
|
||||
}
|
||||
11
constants/routes/authRequired.ts
Normal file
11
constants/routes/authRequired.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { myPages, profile } from "./myPages"
|
||||
|
||||
/**
|
||||
* These are routes in code we know requires auth
|
||||
*
|
||||
* Some of these are rewritten in next.config.js
|
||||
*/
|
||||
export const authRequired = [
|
||||
...Object.values(myPages),
|
||||
...Object.values(profile),
|
||||
]
|
||||
25
constants/routes/handleAuth.js
Normal file
25
constants/routes/handleAuth.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* These are routes for login, logout, signup, etc.
|
||||
*/
|
||||
|
||||
/** @type {import('@/types/routes').LangRoute} */
|
||||
export const login = {
|
||||
da: "/da/log-pa",
|
||||
de: "/de/anmeldung",
|
||||
en: "/en/login",
|
||||
fi: "/fi/kirjaudu-sisaan",
|
||||
no: "/no/logg-inn",
|
||||
sv: "/sv/logga-in",
|
||||
}
|
||||
|
||||
/** @type {import('@/types/routes').LangRoute} */
|
||||
export const logout = {
|
||||
da: "/da/log-ud",
|
||||
de: "/de/ausloggen",
|
||||
en: "/en/logout",
|
||||
fi: "/fi/kirjautua-ulos",
|
||||
no: "/no/logg-ut",
|
||||
sv: "/sv/logga-ut",
|
||||
}
|
||||
|
||||
export const handleAuth = [...Object.values(login), ...Object.values(logout)]
|
||||
28
constants/routes/myPages.js
Normal file
28
constants/routes/myPages.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @file Due to these records being used in next.config.js, and that is required
|
||||
* to be a js file, we use jsdoc to type these.
|
||||
*/
|
||||
|
||||
/**
|
||||
* These are routes that define code entries for My pages
|
||||
*/
|
||||
|
||||
/** @type {import('@/types/routes').LangRoute} */
|
||||
export const myPages = {
|
||||
da: "/da/mine-sider",
|
||||
de: "/de/mein-profil",
|
||||
en: "/en/my-pages",
|
||||
fi: "/fi/minun-sivujani",
|
||||
no: "/no/mine-sider",
|
||||
sv: "/sv/mina-sidor",
|
||||
}
|
||||
|
||||
/** @type {import('@/types/routes').LangRoute} */
|
||||
export const profile = {
|
||||
da: `${myPages.da}/profil-da`,
|
||||
de: `${myPages.de}/profile-de`,
|
||||
en: `${myPages.en}/profile-en`,
|
||||
fi: `${myPages.fi}/profile-fi`,
|
||||
no: `${myPages.no}/profile-no`,
|
||||
sv: `${myPages.sv}/profile-sv`,
|
||||
}
|
||||
Reference in New Issue
Block a user