From fe38a63f1c3d1b195faa27d22b33f1b3f214003a Mon Sep 17 00:00:00 2001 From: Ardeman Date: Sat, 15 Mar 2025 19:43:21 +0800 Subject: [PATCH] refactor: remove unused category column from users dashboard and streamline staff data fetching --- app/pages/dashboard-users/index.tsx | 7 +------ app/routes/_admin.lg-admin.tsx | 12 ++---------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/app/pages/dashboard-users/index.tsx b/app/pages/dashboard-users/index.tsx index 147f187..4f12d16 100644 --- a/app/pages/dashboard-users/index.tsx +++ b/app/pages/dashboard-users/index.tsx @@ -45,10 +45,6 @@ export const UsersPage = () => { title: 'Email', data: 'email', }, - { - title: 'Kategori', - data: 'subscribe.status', - }, { title: 'Status', data: 'subscribe.subscribe_plan.name', @@ -62,8 +58,7 @@ export const UsersPage = () => {
ID: {data.id.slice(0, 8)}
), - 4: (_value: string) => Pribadi, - 5: (value: TColorBadge, _type: unknown, data: TUserResponse) => ( + 4: (value: TColorBadge, _type: unknown, data: TUserResponse) => ( diff --git a/app/routes/_admin.lg-admin.tsx b/app/routes/_admin.lg-admin.tsx index b777061..ad7a2e5 100644 --- a/app/routes/_admin.lg-admin.tsx +++ b/app/routes/_admin.lg-admin.tsx @@ -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) {