diff --git a/src/pages/_layout/client/$clientId/update.tsx b/src/pages/_layout/client/$clientId/update.tsx index c3ddf20..85cb947 100644 --- a/src/pages/_layout/client/$clientId/update.tsx +++ b/src/pages/_layout/client/$clientId/update.tsx @@ -41,7 +41,7 @@ import { queryClient } from '@/pages/__root' import { Skeleton } from '@/components/ui/skeleton' import styles from '@/styles/global.module.css' import { useToken } from '@/lib/context/login' -import { redirect } from '@tanstack/react-router' +// import { redirect } from '@tanstack/react-router' import { ScrollArea } from '@/components/ui/scroll-area' import { ScrollBar } from '@/components/ui/scroll-area' @@ -58,13 +58,15 @@ export const getClientByIdOpt = ({ clientId }: { clientId: string }) => ({ export const Route = createFileRoute('/_layout/client/$clientId/update')({ component: UpdateClientById, loader: async ({ params }) => { - const { rol, userId } = useToken.getState() const data = queryClient.ensureQueryData( queryOptions(getClientByIdOpt(params)) ) - const ownerId = (await data)?.owner.id - if (ownerId !== userId && rol?.rolName !== 'Administrador') - throw redirect({ to: '/client' }) + + // TOOD: change this of site infer in the charge + // const { rol, userId } = useToken.getState() + // const ownerId = (await data)?.owner.id + // if (ownerId !== userId && rol?.rolName !== 'Administrador') + // throw redirect({ to: '/client' }) return { client: defer(data) } }, @@ -91,7 +93,7 @@ export function UpdateClientById() { const init = useRef(client) useEffect(() => { - if (!clientRes) throw Error() + if (!clientRes && isError) throw Error() }, [isError]) const onSuccess = (data: TCLIENT_POST) => { @@ -256,197 +258,202 @@ export function UpdateClientById() { {text.title({ state: !checked })} - + {text.description({ state: !checked })} - - -
label:last-child]:col-span-full [&>label]:space-y-2 [&_*:disabled]:cursor-text [&_*:disabled]:opacity-100', - { - '[&>label>span]:font-bold': checked, - } - )} - > - - - - - - - -