init
This commit is contained in:
26
src/app/routes/_authed/teams.$teamId.tsx
Normal file
26
src/app/routes/_authed/teams.$teamId.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import Page from "@/components/page";
|
||||
import TeamProfile from "@/features/teams/components/team-profile";
|
||||
import { teamQueries } from "@/features/teams/queries";
|
||||
import { redirect, createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/_authed/teams/$teamId")({
|
||||
beforeLoad: async ({ params, context }) => {
|
||||
const { queryClient } = context;
|
||||
const team = await queryClient.ensureQueryData(teamQueries.details(params.teamId))
|
||||
if (!team) throw redirect({ to: '/' });
|
||||
return { team }
|
||||
},
|
||||
loader: ({ params }) => ({
|
||||
header: {
|
||||
collapsed: true,
|
||||
withBackButton: true
|
||||
},
|
||||
refresh: {
|
||||
toRefresh: [teamQueries.details(params.teamId).queryKey],
|
||||
}
|
||||
}),
|
||||
component: () => {
|
||||
const { team } = Route.useRouteContext();
|
||||
return <Page><TeamProfile team={team} /></Page>
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user