main
Some checks failed
UI Deploy (Next-Auth Support) 🎨 / build-and-deploy (push) Failing after 2m42s
Some checks failed
UI Deploy (Next-Auth Support) 🎨 / build-and-deploy (push) Failing after 2m42s
This commit is contained in:
24
src/config/auth.ts
Normal file
24
src/config/auth.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Auth Configuration
|
||||
* Controls whether authentication is required for the app
|
||||
*/
|
||||
|
||||
export const authConfig = {
|
||||
// If true, users must login to access the app
|
||||
// If false, app is public with optional login
|
||||
isAuthRequired: process.env.NEXT_PUBLIC_AUTH_REQUIRED === "true",
|
||||
|
||||
// Public routes that don't require authentication (when auth is required)
|
||||
publicRoutes: ["/signin", "/signup", "/forgot-password"],
|
||||
|
||||
// Routes that should always be protected (even when auth is optional)
|
||||
protectedRoutes: ["/admin", "/settings", "/profile"],
|
||||
};
|
||||
|
||||
export const isPublicRoute = (pathname: string): boolean => {
|
||||
return authConfig.publicRoutes.some((route) => pathname.includes(route));
|
||||
};
|
||||
|
||||
export const isProtectedRoute = (pathname: string): boolean => {
|
||||
return authConfig.protectedRoutes.some((route) => pathname.includes(route));
|
||||
};
|
||||
15
src/config/base-url.ts
Normal file
15
src/config/base-url.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
const isServer = typeof window === "undefined";
|
||||
|
||||
const apiUrl = isServer
|
||||
? process.env.SERVER_API_URL || "http://localhost:3000/api"
|
||||
: process.env.NEXT_PUBLIC_API_URL || "/api/backend";
|
||||
|
||||
const baseUrl = {
|
||||
// Main API Endpoint (Backend)
|
||||
// Logic: Server uses direct HTTP, Client uses Proxy to avoid Mixed Content
|
||||
auth: apiUrl,
|
||||
admin: apiUrl,
|
||||
core: apiUrl,
|
||||
};
|
||||
|
||||
export default baseUrl;
|
||||
15
src/config/navigation.ts
Normal file
15
src/config/navigation.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export type NavChildItem = {
|
||||
label: string;
|
||||
href: string;
|
||||
};
|
||||
|
||||
export type NavItem = {
|
||||
label: string;
|
||||
href: string;
|
||||
children?: NavChildItem[];
|
||||
};
|
||||
|
||||
export const NAV_ITEMS: NavItem[] = [
|
||||
{ label: "home", href: "/home" },
|
||||
{ label: "about", href: "/about" },
|
||||
];
|
||||
Reference in New Issue
Block a user