feat: implement staff management features including staff creation and dashboard layout
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { isRouteErrorResponse } from 'react-router'
|
||||
|
||||
import { StaffsPage } from '~/pages/dashboard-staffs'
|
||||
|
||||
import type { Route } from './+types/_admin.lg-admin._dashboard.staffs._index'
|
||||
|
||||
// export const loader = async ({ request }: Route.LoaderArgs) => {
|
||||
// const { staffToken: accessToken } = await handleCookie(request)
|
||||
// const { data: usersData } = await getUsers({ accessToken })
|
||||
|
||||
// return { usersData }
|
||||
// }
|
||||
|
||||
export const ErrorBoundary = ({ error }: Route.ErrorBoundaryProps) => {
|
||||
let message = 'Oops!'
|
||||
let details = 'An unexpected error occurred.'
|
||||
let stack: string | undefined
|
||||
|
||||
if (isRouteErrorResponse(error)) {
|
||||
message = error.status === 404 ? '404' : 'Error'
|
||||
details =
|
||||
error.status === 404
|
||||
? 'The requested page could not be found.'
|
||||
: error.statusText || details
|
||||
} else if (import.meta.env.DEV && error && error instanceof Error) {
|
||||
details = error.message
|
||||
stack = error.stack
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container mx-auto p-4">
|
||||
<h1>{message}</h1>
|
||||
<p>{details}</p>
|
||||
{stack && (
|
||||
<pre className="w-full p-4 whitespace-pre-wrap">
|
||||
<code>{stack}</code>
|
||||
</pre>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const DashboardStaffsLayout = () => <StaffsPage />
|
||||
export default DashboardStaffsLayout
|
||||
Reference in New Issue
Block a user