2022-02-26 21:27:40 +01:00
|
|
|
export default async function ({ $config, req, res, redirect, route, error }) {
|
2021-09-27 11:12:14 +02:00
|
|
|
if (process.server) {
|
2022-02-26 21:27:40 +01:00
|
|
|
if (res.locals.status === 'SETUP' && route.path !== '/setup/0') {
|
2022-01-26 09:51:42 +01:00
|
|
|
return redirect('/setup/0')
|
2021-09-27 11:12:14 +02:00
|
|
|
}
|
2022-01-26 09:51:42 +01:00
|
|
|
|
2022-02-26 21:27:40 +01:00
|
|
|
if (res.locals.status === 'DBCONF' && route.path !== '/setup/1') {
|
2022-01-26 09:51:42 +01:00
|
|
|
return redirect('/setup/1')
|
|
|
|
}
|
|
|
|
|
2022-02-26 21:27:40 +01:00
|
|
|
if (res.locals.status === 'READY' && route.path.startsWith('/setup')) {
|
2021-09-27 11:12:14 +02:00
|
|
|
return redirect('/')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|