From 9472a11bed34bbac0eb0775ed1ea415ebb32d7b2 Mon Sep 17 00:00:00 2001 From: Satoshi Ebisawa Date: Tue, 22 Oct 2024 09:36:42 +0900 Subject: [PATCH] Unified the logic for verifying the route06 domain --- app/(auth)/lib/is-route06-user.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/(auth)/lib/is-route06-user.ts b/app/(auth)/lib/is-route06-user.ts index cb536463..e5797f31 100644 --- a/app/(auth)/lib/is-route06-user.ts +++ b/app/(auth)/lib/is-route06-user.ts @@ -1,8 +1,7 @@ "use server"; import { getUser } from "@/lib/supabase"; - -const R06_EMAIL_DOMAIN = "route06.co.jp"; +import { isEmailFromRoute06 } from "@/lib/utils"; export const isRoute06User = async () => { const supabaseUser = await getUser(); @@ -12,6 +11,5 @@ export const isRoute06User = async () => { throw new Error("No email found for user"); } - const emailDomain = email.split("@")[1]; - return emailDomain === R06_EMAIL_DOMAIN; + return isEmailFromRoute06(email); };