Add database initialization
now, when the project is ran without configured database, it will prompt for the first user to configure the database and add the first user
This commit is contained in:
parent
cbfc4e9317
commit
90932a49c8
6 changed files with 286 additions and 0 deletions
8
middleware/firstRun.ts
Normal file
8
middleware/firstRun.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { defineNuxtRouteMiddleware, navigateTo, useFetch } from "nuxt/app";
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
const firstRun = await useFetch("/api/firstRun");
|
||||
|
||||
if (firstRun.data.value)
|
||||
return navigateTo({ path: "/firstRun" });
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue