mirror of https://github.com/wg-easy/wg-easy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
450 B
18 lines
450 B
/* First setup of wg-easy app */
|
|
export default defineEventHandler(async (event) => {
|
|
const url = getRequestURL(event);
|
|
|
|
if (
|
|
url.pathname.startsWith('/setup') ||
|
|
url.pathname === '/api/account/new' ||
|
|
url.pathname === '/api/features'
|
|
) {
|
|
return;
|
|
}
|
|
|
|
const users = await Database.getUsers();
|
|
// TODO: better error messages for api requests
|
|
if (users.length === 0) {
|
|
return sendRedirect(event, '/setup', 302);
|
|
}
|
|
});
|
|
|