11import { Icon } from "@iconify-icon/react" ;
22import { useMutation } from "@tanstack/react-query" ;
3- import { createFileRoute , redirect } from "@tanstack/react-router" ;
3+ import { createFileRoute } from "@tanstack/react-router" ;
44import { useState } from "react" ;
55import { z } from "zod" ;
66
77import { cn } from "@hypr/utils" ;
88
99import { Image } from "@/components/image" ;
1010import { doAuth , doMagicLinkAuth } from "@/functions/auth" ;
11- import { getSupabaseServerClient } from "@/functions/supabase" ;
1211
1312const validateSearch = z . object ( {
1413 flow : z . enum ( [ "desktop" , "web" ] ) . default ( "web" ) ,
@@ -19,28 +18,6 @@ const validateSearch = z.object({
1918export const Route = createFileRoute ( "/auth" ) ( {
2019 validateSearch,
2120 component : Component ,
22- beforeLoad : async ( { search } ) => {
23- const supabase = getSupabaseServerClient ( ) ;
24- const { data : sessionData } = await supabase . auth . getSession ( ) ;
25-
26- if ( sessionData . session ) {
27- if ( search . flow === "desktop" ) {
28- throw redirect ( {
29- to : "/callback/auth" ,
30- search : {
31- flow : "desktop" ,
32- scheme : search . scheme || "hyprnote" ,
33- access_token : sessionData . session . access_token ,
34- refresh_token : sessionData . session . refresh_token ,
35- } ,
36- } ) ;
37- }
38-
39- if ( search . flow === "web" ) {
40- throw redirect ( { href : search . redirect || "/app/account" } ) ;
41- }
42- }
43- } ,
4421} ) ;
4522
4623function Component ( ) {
0 commit comments