feat: add onboarding with oldmarr import (#1606)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import type { NextRequest } from "next/server";
|
||||
import { createTRPCClient, httpLink } from "@trpc/client";
|
||||
import SuperJSON from "superjson";
|
||||
@@ -11,6 +12,15 @@ export async function middleware(request: NextRequest) {
|
||||
// In next 15 we will be able to use node apis and such the db directly
|
||||
const culture = await serverFetchApi.serverSettings.getCulture.query();
|
||||
|
||||
// Redirect to onboarding if it's not finished yet
|
||||
const pathname = request.nextUrl.pathname;
|
||||
if (!pathname.endsWith("/init")) {
|
||||
const currentOnboardingStep = await serverFetchApi.onboard.currentStep.query();
|
||||
if (currentOnboardingStep.current !== "finish") {
|
||||
return NextResponse.redirect(new URL("/init", request.url));
|
||||
}
|
||||
}
|
||||
|
||||
// We don't want to fallback to accept-language header so we clear it
|
||||
request.headers.set("accept-language", "");
|
||||
const next = createI18nMiddleware(culture.defaultLocale);
|
||||
|
||||
Reference in New Issue
Block a user