feat: refactor login handling to use staff-login page and update related imports

This commit is contained in:
Ardeman 2025-03-04 09:44:09 +08:00
parent 8aeb7a3197
commit 6d8e352ffc
5 changed files with 40 additions and 27 deletions

View File

@ -1,7 +1,7 @@
import { z } from 'zod'
import { HttpServer } from '~/libs/http-server'
import type { TLoginSchema } from '~/pages/admin-login'
import type { TLoginSchema } from '~/pages/staff-login'
const loginResponseSchema = z.object({
data: z.object({

View File

@ -1,6 +1,7 @@
import { Field, Input, Label, Select } from '@headlessui/react'
import DT from 'datatables.net-dt'
import DataTable from 'datatables.net-react'
import { Link } from 'react-router'
import { SearchIcon } from '~/components/icons/search'
import { Button } from '~/components/ui/button'
@ -57,10 +58,13 @@ export const ContentsPage = () => {
return (
<div className="relative">
<TitleDashboard title="Konten" />
<div className="mb-8 flex items-center gap-5 rounded-lg bg-gray-50 text-[#363636]">
<div className="mb-8 flex items-end justify-between">
<div className="flex items-center gap-5 rounded-lg bg-gray-50 text-[#363636]">
<div className="w-[400px]">
<Field>
<Label className="mb-2 block text-sm font-medium">Cari User</Label>
<Label className="mb-2 block text-sm font-medium">
Cari User
</Label>
<div className="relative">
<Input
type="text"
@ -85,6 +89,15 @@ export const ContentsPage = () => {
</Field>
</div>
</div>
<Button
as={Link}
to="/lg-admin/contents/create"
className="text-md rounded-md"
size="lg"
>
Create New
</Button>
</div>
<UiTable
data={dataTable}

View File

@ -1,4 +1,4 @@
import { AdminLoginPage } from '~/pages/admin-login'
import { AdminLoginPage } from '~/pages/staff-login'
const AuthLayout = () => <AdminLoginPage />
export default AuthLayout

View File

@ -5,7 +5,7 @@ import { XiorError } from 'xior'
import { getStaff } from '~/apis/admin/get-staff'
import { staffLoginRequest } from '~/apis/admin/login-staff'
import { loginSchema, type TLoginSchema } from '~/pages/admin-login'
import { loginSchema, type TLoginSchema } from '~/pages/staff-login'
import { generateStaffTokenCookie } from '~/utils/token'
import type { Route } from './+types/actions.login'