Compare commits

..

5 Commits

6 changed files with 66 additions and 20047 deletions

8
.prettierrc.json Normal file
View File

@ -0,0 +1,8 @@
{
"bracketSpacing": true,
"bracketSameLine": true,
"quoteProps": "consistent",
"semi": true,
"singleQuote": false,
"trailingComma": "all"
}

View File

@ -3,7 +3,8 @@ import type {
AuthActionResponse, AuthActionResponse,
CheckResponse, CheckResponse,
OnErrorResponse OnErrorResponse
} from "@refinedev/core/dist/interfaces" // @ts-ignore
} from "@refinedev/core/dist/interfaces/bindings/auth"
export const authProvider: AuthProvider = { export const authProvider: AuthProvider = {
login: async (params: any) => { login: async (params: any) => {

View File

@ -11,6 +11,9 @@ 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 },
@ -35,7 +38,14 @@ export function Layout({ children }: { children: React.ReactNode }) {
} }
export default function App() { export default function App() {
return <Outlet />; return (
<Refine
authProvider={authProvider}
routerProvider={routerProvider}
>
<Outlet/>
</Refine>
);
} }
export function HydrateFallback() { export function HydrateFallback() {

View File

@ -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() { export default function Index() {
const isLogged = false const { isLoading, data } = useIsAuthenticated();
if (isLogged) { const go = useGo();
window.location.href = "/dashboard"
} else { useEffect(() => {
window.location.href = "/login" 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 />;
} }

20014
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,10 @@
"@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": "^4.47.2", "@refinedev/core": "https://gitpkg.now.sh/LumeWeb/refine/packages/core?remix",
"@refinedev/remix-router": "^3.0.0", "@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/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",