feat: billing guest access

This commit is contained in:
2024-08-08 07:54:43 +03:00
parent 925f1b4407
commit 1ad96e3a69
36 changed files with 644 additions and 53 deletions

View File

@@ -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}/>