import { createFileRoute } from "@tanstack/react-router";

import z from "zod";

import ResetForm from "./-components/ResetForm";
import ResetPassword from "./-components/ResetPassword";

export const Route = createFileRoute("/(auth)/user/resetpassword")({
	validateSearch: z.object({
		token: z.string().optional(),
	}),
	component: RouteComponent,
});

function RouteComponent() {
	const { token } = Route.useSearch();

	return (
		<div className="">
			{token ? <ResetPassword token={token} /> : <ResetForm />}
		</div>
	);
}
