refactor res.locals and settings

This commit is contained in:
lesion
2022-02-26 21:27:40 +01:00
parent 9e2ed063b6
commit cf3e1c69fa
20 changed files with 133 additions and 102 deletions

View File

@@ -1,14 +1,14 @@
export default async function ({ $config, req, redirect, route, error }) {
export default async function ({ $config, req, res, redirect, route, error }) {
if (process.server) {
if (req.status === 'SETUP' && route.path !== '/setup/0') {
if (res.locals.status === 'SETUP' && route.path !== '/setup/0') {
return redirect('/setup/0')
}
if (req.status === 'DBCONF' && route.path !== '/setup/1') {
if (res.locals.status === 'DBCONF' && route.path !== '/setup/1') {
return redirect('/setup/1')
}
if (req.status === 'READY' && route.path.startsWith('/setup')) {
if (res.locals.status === 'READY' && route.path.startsWith('/setup')) {
return redirect('/')
}
}