car_mms/app/routes/_index.tsx
2025-09-11 14:22:27 +03:00

22 lines
707 B
TypeScript

import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node";
import { redirect } from "@remix-run/node";
import { getUserId } from "~/lib/auth.server";
export const meta: MetaFunction = () => {
return [
{ title: "نظام إدارة صيانة السيارات" },
{ name: "description", content: "نظام شامل لإدارة صيانة السيارات" },
];
};
export async function loader({ request }: LoaderFunctionArgs) {
const userId = await getUserId(request);
if (userId) {
// User is authenticated, redirect to dashboard
return redirect("/dashboard");
} else {
// User is not authenticated, redirect to signin
return redirect("/signin");
}
}