feat: billing guest access
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
import {createRootRoute, redirect} from "@tanstack/react-router";
|
||||
import RootPage from "../pages/RootPage/RootPage.tsx";
|
||||
import {SearchParams} from "../shared/lib/general.ts";
|
||||
|
||||
export const Route = createRootRoute({
|
||||
component: RootPage,
|
||||
beforeLoad: async ({location}) => {
|
||||
beforeLoad: async ({location, search}) => {
|
||||
const isAuthorized = JSON.parse(localStorage.getItem('authState') || '{}')['isAuthorized'];
|
||||
const searchParams: SearchParams = search;
|
||||
if (searchParams.accessToken) {
|
||||
return;
|
||||
}
|
||||
if (!isAuthorized && location.pathname !== '/login') {
|
||||
throw redirect({
|
||||
to: '/login',
|
||||
|
||||
8
src/routes/deals.$dealId.tsx
Normal file
8
src/routes/deals.$dealId.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import {createFileRoute} from "@tanstack/react-router";
|
||||
import {DealPage} from "../pages/DealPage";
|
||||
|
||||
export const Route = createFileRoute("/deals/$dealId")({
|
||||
component: DealPage
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {createLazyFileRoute} from "@tanstack/react-router";
|
||||
import DebouncedNumberInput from "../components/DebouncedNumberInput/DebouncedNumberInput.tsx";
|
||||
import {useEffect, useState} from "react";
|
||||
import {isNumber} from "lodash";
|
||||
|
||||
export const Route = createLazyFileRoute('/test')({
|
||||
component: TestPage
|
||||
@@ -9,14 +6,8 @@ export const Route = createLazyFileRoute('/test')({
|
||||
|
||||
|
||||
function TestPage() {
|
||||
const [value, setValue] = useState(0);
|
||||
useEffect(() => {
|
||||
}, [value]);
|
||||
return (
|
||||
<>
|
||||
<DebouncedNumberInput
|
||||
onChange={(event) => isNumber(event) && setValue(event)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user