Compare commits
No commits in common. "292b8b2f21e5227084714e9980781601a6e1a0df" and "467c29c82c27910d5b8f870efe477cd85698f8bd" have entirely different histories.
292b8b2f21
...
467c29c82c
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"bracketSpacing": true,
|
|
||||||
"bracketSameLine": true,
|
|
||||||
"quoteProps": "consistent",
|
|
||||||
"semi": true,
|
|
||||||
"singleQuote": false,
|
|
||||||
"trailingComma": "all"
|
|
||||||
}
|
|
|
@ -3,8 +3,7 @@ import type {
|
||||||
AuthActionResponse,
|
AuthActionResponse,
|
||||||
CheckResponse,
|
CheckResponse,
|
||||||
OnErrorResponse
|
OnErrorResponse
|
||||||
// @ts-ignore
|
} from "@refinedev/core/dist/interfaces"
|
||||||
} from "@refinedev/core/dist/interfaces/bindings/auth"
|
|
||||||
|
|
||||||
export const authProvider: AuthProvider = {
|
export const authProvider: AuthProvider = {
|
||||||
login: async (params: any) => {
|
login: async (params: any) => {
|
||||||
|
|
26
app/root.tsx
26
app/root.tsx
|
@ -11,41 +11,31 @@ import type { LinksFunction } from "@remix-run/node";
|
||||||
|
|
||||||
// Supports weights 200-800
|
// Supports weights 200-800
|
||||||
import '@fontsource-variable/manrope';
|
import '@fontsource-variable/manrope';
|
||||||
import {Refine} from "@refinedev/core";
|
|
||||||
import {authProvider} from "~/data/auth-provider.js";
|
|
||||||
import routerProvider from "@refinedev/remix-router";
|
|
||||||
|
|
||||||
export const links: LinksFunction = () => [
|
export const links: LinksFunction = () => [
|
||||||
{ rel: "stylesheet", href: stylesheet },
|
{ rel: "stylesheet", href: stylesheet },
|
||||||
];
|
];
|
||||||
|
|
||||||
export function Layout({children}: { children: React.ReactNode }) {
|
export function Layout({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8"/>
|
<meta charSet="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<Meta/>
|
<Meta />
|
||||||
<Links/>
|
<Links />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{children}
|
{children}
|
||||||
<ScrollRestoration/>
|
<ScrollRestoration />
|
||||||
<Scripts/>
|
<Scripts />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return <Outlet />;
|
||||||
<Refine
|
|
||||||
authProvider={authProvider}
|
|
||||||
routerProvider={routerProvider}
|
|
||||||
>
|
|
||||||
<Outlet/>
|
|
||||||
</Refine>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function HydrateFallback() {
|
export function HydrateFallback() {
|
||||||
|
|
|
@ -1,25 +1,13 @@
|
||||||
import Login from "./login";
|
import Login from "./login"
|
||||||
import { useGo, useIsAuthenticated } from "@refinedev/core";
|
|
||||||
import { useEffect } from "react";
|
|
||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
const { isLoading, data } = useIsAuthenticated();
|
const isLogged = false
|
||||||
|
|
||||||
const go = useGo();
|
if (isLogged) {
|
||||||
|
window.location.href = "/dashboard"
|
||||||
useEffect(() => {
|
} else {
|
||||||
if (!isLoading && data?.authenticated) {
|
window.location.href = "/login"
|
||||||
go({ to: "/dashboard", type: "replace" });
|
|
||||||
}
|
|
||||||
}, [isLoading, data]);
|
|
||||||
|
|
||||||
if (isLoading) {
|
|
||||||
return <>Checking Login Status</> || null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data?.authenticated) {
|
return isLogged ? <div>Dashboard</div> : <Login />
|
||||||
return <>Redirecting</> || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <Login />;
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,10 +24,8 @@
|
||||||
"@radix-ui/react-progress": "^1.0.3",
|
"@radix-ui/react-progress": "^1.0.3",
|
||||||
"@radix-ui/react-slot": "^1.0.2",
|
"@radix-ui/react-slot": "^1.0.2",
|
||||||
"@refinedev/cli": "^2.16.1",
|
"@refinedev/cli": "^2.16.1",
|
||||||
"@refinedev/core": "https://gitpkg.now.sh/LumeWeb/refine/packages/core?remix",
|
"@refinedev/core": "^4.47.2",
|
||||||
"@refinedev/devtools-internal": "https://gitpkg.now.sh/LumeWeb/refine/packages/devtools-internal?remix",
|
"@refinedev/remix-router": "^3.0.0",
|
||||||
"@refinedev/devtools-shared": "https://gitpkg.now.sh/LumeWeb/refine/packages/devtools-shared?remix",
|
|
||||||
"@refinedev/remix-router": "https://gitpkg.now.sh/LumeWeb/refine/packages/remix?remix",
|
|
||||||
"@remix-run/node": "^2.8.0",
|
"@remix-run/node": "^2.8.0",
|
||||||
"@remix-run/react": "^2.8.0",
|
"@remix-run/react": "^2.8.0",
|
||||||
"@tanstack/react-table": "^8.13.2",
|
"@tanstack/react-table": "^8.13.2",
|
||||||
|
|
Loading…
Reference in New Issue