fix: session issues
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { createFileRoute, redirect } from '@tanstack/react-router';
|
||||
import { MailIcon } from 'lucide-react';
|
||||
import { z } from 'zod';
|
||||
import { Or } from '@/components/auth/or';
|
||||
import { SignInGithub } from '@/components/auth/sign-in-github';
|
||||
import { SignInGoogle } from '@/components/auth/sign-in-google';
|
||||
import { SignUpEmailForm } from '@/components/auth/sign-up-email-form';
|
||||
import FullPageLoadingState from '@/components/full-page-loading-state';
|
||||
import { LogoSquare } from '@/components/logo';
|
||||
import { useTRPC } from '@/integrations/trpc/react';
|
||||
import { PAGE_TITLES, createEntityTitle } from '@/utils/title';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { createFileRoute, redirect } from '@tanstack/react-router';
|
||||
import { motion } from 'framer-motion';
|
||||
import { MailIcon } from 'lucide-react';
|
||||
import { z } from 'zod';
|
||||
import { createEntityTitle, PAGE_TITLES } from '@/utils/title';
|
||||
|
||||
const validateSearch = z.object({
|
||||
inviteId: z.string().optional(),
|
||||
});
|
||||
@@ -22,7 +21,7 @@ export const Route = createFileRoute('/_public/onboarding')({
|
||||
],
|
||||
}),
|
||||
beforeLoad: async ({ context }) => {
|
||||
if (context.session.session) {
|
||||
if (context.session?.session) {
|
||||
throw redirect({ to: '/' });
|
||||
}
|
||||
},
|
||||
@@ -34,7 +33,7 @@ export const Route = createFileRoute('/_public/onboarding')({
|
||||
await context.queryClient.prefetchQuery(
|
||||
context.trpc.organization.getInvite.queryOptions({
|
||||
inviteId: search.data.inviteId,
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -47,36 +46,36 @@ function Component() {
|
||||
const { data: invite } = useQuery(
|
||||
trpc.organization.getInvite.queryOptions(
|
||||
{
|
||||
inviteId: inviteId,
|
||||
inviteId,
|
||||
},
|
||||
{
|
||||
enabled: !!inviteId,
|
||||
},
|
||||
),
|
||||
}
|
||||
)
|
||||
);
|
||||
return (
|
||||
<div className="col gap-8 w-full text-left">
|
||||
<div className="col w-full gap-8 text-left">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-foreground mb-2">
|
||||
<h1 className="mb-2 font-bold text-3xl text-foreground">
|
||||
Create an account
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Let's start with creating your account. By creating an account you
|
||||
accept the{' '}
|
||||
<a
|
||||
target="_blank"
|
||||
className="underline transition-colors hover:text-foreground"
|
||||
href="https://openpanel.dev/terms"
|
||||
rel="noreferrer"
|
||||
className="underline hover:text-foreground transition-colors"
|
||||
target="_blank"
|
||||
>
|
||||
Terms of Service
|
||||
</a>{' '}
|
||||
and{' '}
|
||||
<a
|
||||
target="_blank"
|
||||
className="underline transition-colors hover:text-foreground"
|
||||
href="https://openpanel.dev/privacy"
|
||||
rel="noreferrer"
|
||||
className="underline hover:text-foreground transition-colors"
|
||||
target="_blank"
|
||||
>
|
||||
Privacy Policy
|
||||
</a>
|
||||
@@ -85,8 +84,8 @@ function Component() {
|
||||
</div>
|
||||
|
||||
{invite && !invite.isExpired && (
|
||||
<div className="bg-card border border-border rounded-lg p-6 mb-6">
|
||||
<h2 className="text-xl font-semibold mb-2">
|
||||
<div className="mb-6 rounded-lg border border-border bg-card p-6">
|
||||
<h2 className="mb-2 font-semibold text-xl">
|
||||
Invitation to {invite.organization?.name}
|
||||
</h2>
|
||||
<p className="text-muted-foreground">
|
||||
@@ -96,8 +95,8 @@ function Component() {
|
||||
</div>
|
||||
)}
|
||||
{invite?.isExpired && (
|
||||
<div className="bg-destructive/10 border border-destructive/20 rounded-lg p-6 mb-6">
|
||||
<h2 className="text-xl font-semibold mb-2 text-destructive">
|
||||
<div className="mb-6 rounded-lg border border-destructive/20 bg-destructive/10 p-6">
|
||||
<h2 className="mb-2 font-semibold text-destructive text-xl">
|
||||
Invitation to {invite.organization?.name} has expired
|
||||
</h2>
|
||||
<p className="text-muted-foreground">
|
||||
@@ -108,14 +107,14 @@ function Component() {
|
||||
)}
|
||||
|
||||
<div className="space-y-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<SignInGithub type="sign-up" inviteId={inviteId} />
|
||||
<SignInGoogle type="sign-up" inviteId={inviteId} />
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<SignInGithub inviteId={inviteId} type="sign-up" />
|
||||
<SignInGoogle inviteId={inviteId} type="sign-up" />
|
||||
</div>
|
||||
|
||||
<Or className="my-6" />
|
||||
|
||||
<div className="flex items-center gap-2 font-semibold mb-4 text-lg">
|
||||
<div className="mb-4 flex items-center gap-2 font-semibold text-lg">
|
||||
<MailIcon className="size-4" />
|
||||
Sign up with email
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user