Compare commits
5 Commits
467c29c82c
...
292b8b2f21
Author | SHA1 | Date |
---|---|---|
Juan Di Toro | 292b8b2f21 | |
Derrick Hammer | 069fdb49bd | |
Derrick Hammer | 427bdbb407 | |
Derrick Hammer | 552bf84247 | |
Derrick Hammer | 2f53b37775 |
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"bracketSpacing": true,
|
||||
"bracketSameLine": true,
|
||||
"quoteProps": "consistent",
|
||||
"semi": true,
|
||||
"singleQuote": false,
|
||||
"trailingComma": "all"
|
||||
}
|
|
@ -3,7 +3,8 @@ import type {
|
|||
AuthActionResponse,
|
||||
CheckResponse,
|
||||
OnErrorResponse
|
||||
} from "@refinedev/core/dist/interfaces"
|
||||
// @ts-ignore
|
||||
} from "@refinedev/core/dist/interfaces/bindings/auth"
|
||||
|
||||
export const authProvider: AuthProvider = {
|
||||
login: async (params: any) => {
|
||||
|
@ -30,7 +31,7 @@ export const authProvider: AuthProvider = {
|
|||
getPermissions: async (params: any) => {
|
||||
return { success: true } satisfies AuthActionResponse
|
||||
},
|
||||
getIdentity: async (params: any) => {
|
||||
getIdentity: async (params: any) => {
|
||||
return { id: "1", fullName: "John Doe", avatar: "https://via.placeholder.com/150" }
|
||||
}
|
||||
}
|
||||
|
|
54
app/root.tsx
54
app/root.tsx
|
@ -1,9 +1,9 @@
|
|||
import {
|
||||
Links,
|
||||
Meta,
|
||||
Outlet,
|
||||
Scripts,
|
||||
ScrollRestoration,
|
||||
Links,
|
||||
Meta,
|
||||
Outlet,
|
||||
Scripts,
|
||||
ScrollRestoration,
|
||||
} from "@remix-run/react";
|
||||
|
||||
import stylesheet from "./tailwind.css?url";
|
||||
|
@ -11,33 +11,43 @@ import type { LinksFunction } from "@remix-run/node";
|
|||
|
||||
// Supports weights 200-800
|
||||
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 = () => [
|
||||
{ rel: "stylesheet", href: stylesheet },
|
||||
];
|
||||
|
||||
export function Layout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<Meta />
|
||||
<Links />
|
||||
</head>
|
||||
<body>
|
||||
export function Layout({children}: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charSet="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<Meta/>
|
||||
<Links/>
|
||||
</head>
|
||||
<body>
|
||||
{children}
|
||||
<ScrollRestoration />
|
||||
<Scripts />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
<ScrollRestoration/>
|
||||
<Scripts/>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return <Outlet />;
|
||||
return (
|
||||
<Refine
|
||||
authProvider={authProvider}
|
||||
routerProvider={routerProvider}
|
||||
>
|
||||
<Outlet/>
|
||||
</Refine>
|
||||
);
|
||||
}
|
||||
|
||||
export function HydrateFallback() {
|
||||
return <p>Loading...</p>;
|
||||
return <p>Loading...</p>;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,25 @@
|
|||
import Login from "./login"
|
||||
import Login from "./login";
|
||||
import { useGo, useIsAuthenticated } from "@refinedev/core";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function Index() {
|
||||
const isLogged = false
|
||||
const { isLoading, data } = useIsAuthenticated();
|
||||
|
||||
if (isLogged) {
|
||||
window.location.href = "/dashboard"
|
||||
} else {
|
||||
window.location.href = "/login"
|
||||
const go = useGo();
|
||||
|
||||
useEffect(() => {
|
||||
if (!isLoading && data?.authenticated) {
|
||||
go({ to: "/dashboard", type: "replace" });
|
||||
}
|
||||
}, [isLoading, data]);
|
||||
|
||||
if (isLoading) {
|
||||
return <>Checking Login Status</> || null;
|
||||
}
|
||||
|
||||
return isLogged ? <div>Dashboard</div> : <Login />
|
||||
if (data?.authenticated) {
|
||||
return <>Redirecting</> || null;
|
||||
}
|
||||
|
||||
return <Login />;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,8 +24,10 @@
|
|||
"@radix-ui/react-progress": "^1.0.3",
|
||||
"@radix-ui/react-slot": "^1.0.2",
|
||||
"@refinedev/cli": "^2.16.1",
|
||||
"@refinedev/core": "^4.47.2",
|
||||
"@refinedev/remix-router": "^3.0.0",
|
||||
"@refinedev/core": "https://gitpkg.now.sh/LumeWeb/refine/packages/core?remix",
|
||||
"@refinedev/devtools-internal": "https://gitpkg.now.sh/LumeWeb/refine/packages/devtools-internal?remix",
|
||||
"@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/react": "^2.8.0",
|
||||
"@tanstack/react-table": "^8.13.2",
|
||||
|
|
Loading…
Reference in New Issue