refactor: remove unused category column from users dashboard and streamline staff data fetching
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import { isRouteErrorResponse, Outlet, redirect } from 'react-router'
|
||||
import { XiorError } from 'xior'
|
||||
|
||||
import { getStaff } from '~/apis/admin/get-staff'
|
||||
import { AUTH_PAGES } from '~/configs/pages'
|
||||
import { AdminDefaultLayout } from '~/layouts/admin/default'
|
||||
import { handleCookie } from '~/libs/cookies'
|
||||
import { setStaffLogoutHeaders } from '~/libs/logout-header.server'
|
||||
|
||||
import type { Route } from './+types/_admin.lg-admin'
|
||||
|
||||
@@ -16,14 +14,8 @@ export const loader = async ({ request }: Route.LoaderArgs) => {
|
||||
let staffData
|
||||
|
||||
if (accessToken) {
|
||||
try {
|
||||
const { data } = await getStaff({ accessToken })
|
||||
staffData = data
|
||||
} catch (error) {
|
||||
if (error instanceof XiorError && error.response?.status === 401) {
|
||||
setStaffLogoutHeaders()
|
||||
}
|
||||
}
|
||||
const { data } = await getStaff({ accessToken })
|
||||
staffData = data
|
||||
}
|
||||
|
||||
if (!isAuthPage && !accessToken) {
|
||||
|
||||
Reference in New Issue
Block a user