File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Key } from "lucide-react" ;
22import { Button } from "~/components/ui/button" ;
3- import { Link , useLoaderData } from "react-router" ;
4- import type { loader } from "~/routes/_index" ;
3+ import { Link } from "react-router" ;
54
65const DashboardButton = ( ) => {
7- const { isAuthenticated } = useLoaderData < typeof loader > ( ) ;
8-
96 return (
107 < Button
118 size = "lg"
129 variant = "outline"
1310 className = "w-full sm:w-auto border-primary-foreground/30 text-primary-background hover:bg-primary-foreground/10 px-8 hover:text-primary-foreground"
1411 asChild
1512 >
16- { isAuthenticated ? (
17- < Link to = { `/dashboard` } >
18- < Key className = "w-4 h-4" />
19- Przejdź do panelu
20- </ Link >
21- ) : (
22- < Link to = { `/auth/google` } >
23- < Key className = "w-4 h-4" />
24- Zaloguj się do panelu
25- </ Link >
26- ) }
13+ < Link to = "/dashboard" >
14+ < Key className = "w-4 h-4" />
15+ Zaloguj się do panelu
16+ </ Link >
2717 </ Button >
2818 ) ;
2919} ;
Original file line number Diff line number Diff line change 11import { useLoaderData } from "react-router" ;
2- import type { LoaderFunctionArgs , MetaFunction } from "react-router" ;
2+ import type { MetaFunction } from "react-router" ;
33import { randomUUID } from "crypto" ;
44import jwt from "jsonwebtoken" ;
55import { defaultApi } from "~/api/api" ;
66import { getBootstrap } from "~/api/bootstrap" ;
7- import { getSession } from "~/session" ;
87import Hero from "~/components/landing-page/hero" ;
98import Features from "~/components/landing-page/features" ;
109import Screenshots from "~/components/landing-page/screenshots" ;
@@ -41,9 +40,8 @@ export default function Index() {
4140 ) ;
4241}
4342
44- export async function loader ( { request } : LoaderFunctionArgs ) {
43+ export async function loader ( ) {
4544 const bootstrap = await getBootstrap ( defaultApi ) ;
46- const session = await getSession ( request . headers . get ( "Cookie" ) ) ;
4745
4846 const hasWaitlist = Boolean ( process . env . WAITLIST_API_URL ) ;
4947 let formToken = "" ;
@@ -58,7 +56,6 @@ export async function loader({ request }: LoaderFunctionArgs) {
5856 return {
5957 appDownloadUrl : bootstrap . appDownloadUrl ,
6058 contactUrl : bootstrap . contactUrl ,
61- isAuthenticated : Boolean ( session . data ?. accessToken ) ,
6259 hasWaitlist,
6360 formToken,
6461 } ;
Original file line number Diff line number Diff line change 11import { LoaderFunctionArgs , redirect } from "react-router" ;
22import { getSongs } from "~/api/songs" ;
33import { SiteHeader } from "~/components/site-header" ;
4- import { createAuthenticatedApi , requireSession } from "~/session" ;
4+ import { createAuthenticatedApi , requireSessionWithRefresh } from "~/session" ;
55
66export default function DashboardIndex ( ) {
77 return (
@@ -12,7 +12,7 @@ export default function DashboardIndex() {
1212}
1313
1414export async function loader ( { request } : LoaderFunctionArgs ) {
15- const session = await requireSession ( request ) ;
15+ const session = await requireSessionWithRefresh ( request ) ;
1616 const api = await createAuthenticatedApi ( session ) ;
1717
1818 const currentTeamId = session . get ( "teamId" ) ?? "" ;
You can’t perform that action at this time.
0 commit comments