feat: billing guest access
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
import {useMatch, useMatches} from "@tanstack/react-router";
|
||||
import {useMatch, useMatches, useSearch} from "@tanstack/react-router";
|
||||
import {useEffect} from "react";
|
||||
import {useSelector} from "react-redux";
|
||||
import {RootState} from "../../redux/store.ts";
|
||||
import {RootState, useAppDispatch} from "../../redux/store.ts";
|
||||
import {OpenAPI} from "../../client";
|
||||
import PageWrapper from "../PageWrapper/PageWrapper.tsx";
|
||||
import {LoadingOverlay} from "@mantine/core";
|
||||
import {AnimatePresence} from "framer-motion";
|
||||
import AnimatedOutlet from "../../components/AnimatedOutlet/au.tsx";
|
||||
import {SearchParams} from "../../shared/lib/general.ts";
|
||||
import {login} from "../../features/authSlice.ts";
|
||||
|
||||
const RootPage = () => {
|
||||
|
||||
const search: SearchParams = useSearch({strict: false});
|
||||
const dispatch = useAppDispatch();
|
||||
const matches = useMatches();
|
||||
const match = useMatch({strict: false});
|
||||
const nextMatchIndex = matches.findIndex((d) => d.id === match.id) + 1;
|
||||
@@ -27,6 +32,10 @@ const RootPage = () => {
|
||||
rewriteLocalStorage();
|
||||
setOpenApiToken();
|
||||
}, [authState]);
|
||||
useEffect(() => {
|
||||
if (!search.accessToken) return;
|
||||
dispatch(login({accessToken: search.accessToken.toString()}))
|
||||
}, [search])
|
||||
return (
|
||||
<>
|
||||
<LoadingOverlay visible={uiState.isLoading}/>
|
||||
|
||||
Reference in New Issue
Block a user