feat: implement logout action
This commit is contained in:
+19
-6
@@ -6,6 +6,7 @@ import {
|
||||
Outlet,
|
||||
Scripts,
|
||||
ScrollRestoration,
|
||||
type ShouldRevalidateFunctionArgs,
|
||||
} from 'react-router'
|
||||
|
||||
import type { Route } from './+types/root'
|
||||
@@ -36,7 +37,17 @@ export const meta = ({ location }: Route.MetaArgs) => {
|
||||
]
|
||||
}
|
||||
|
||||
export function Layout({ children }: { children: ReactNode }) {
|
||||
export const shouldRevalidate = ({
|
||||
actionResult,
|
||||
defaultShouldRevalidate,
|
||||
}: ShouldRevalidateFunctionArgs) => {
|
||||
if (actionResult?.success) {
|
||||
return true
|
||||
}
|
||||
return defaultShouldRevalidate
|
||||
}
|
||||
|
||||
export const Layout = ({ children }: { children: ReactNode }) => {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -57,11 +68,7 @@ export function Layout({ children }: { children: ReactNode }) {
|
||||
)
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return <Outlet />
|
||||
}
|
||||
|
||||
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
||||
export const ErrorBoundary = ({ error }: Route.ErrorBoundaryProps) => {
|
||||
let message = 'Oops!'
|
||||
let details = 'An unexpected error occurred.'
|
||||
let stack: string | undefined
|
||||
@@ -89,3 +96,9 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
const App = () => {
|
||||
return <Outlet />
|
||||
}
|
||||
|
||||
export default App
|
||||
|
||||
Reference in New Issue
Block a user