feat: add API endpoints for fetching staff profiles and staff list

This commit is contained in:
Ardeman
2025-03-25 19:07:29 +08:00
parent dce745f53d
commit 84451f1fd4
8 changed files with 82 additions and 72 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import { data } from 'react-router'
import { getValidatedFormData } from 'remix-hook-form'
import { XiorError } from 'xior'
import { getStaff } from '~/apis/admin/get-staff'
import { getProfile } from '~/apis/admin/get-profile'
import { staffLoginRequest } from '~/apis/admin/login-staff'
import { loginSchema, type TLoginSchema } from '~/pages/staff-login'
import { generateStaffTokenCookie } from '~/utils/token'
@@ -28,7 +28,7 @@ export const action = async ({ request }: Route.ActionArgs) => {
const { data: loginData } = await staffLoginRequest(payload)
const { token: accessToken } = loginData
const { data: staffData } = await getStaff({ accessToken })
const { data: staffData } = await getProfile({ accessToken })
const tokenCookie = generateStaffTokenCookie({ accessToken })
const headers = new Headers()