feat:update web

This commit is contained in:
TuanVT
2026-05-24 23:33:43 +07:00
parent b6ccde2c74
commit b0baa509d9
58 changed files with 4920 additions and 292 deletions
@@ -26,7 +26,7 @@ import { PATH } from "@/constant/config";
import FormCustom from "@/components/utils/FormCustom";
import InputForm from "@/components/utils/FormCustom/components/InputForm";
import CustomLoading from "@/components/customs/custom-loading";
// import FormCustom, { InputForm } from "@/components/common/FormCustom";
import CustomButton from "@/components/customs/custom-button";
export default function MainLogin() {
const router = useRouter();
@@ -39,6 +39,8 @@ export default function MainLogin() {
username: isRememberPassword ? dataLoginStorage?.usernameStorage || "" : "",
password: isRememberPassword ? dataLoginStorage?.passwordStorage || "" : "",
deviceId: isRememberPassword ? dataLoginStorage?.deviceIdStorage || "" : "",
});
const loginMutation = useMutation({
@@ -50,9 +52,7 @@ export default function MainLogin() {
http: authServices.login({
username: form.username,
password: form.password,
ip: "",
address: "",
type: 0,
deviceId: form.deviceId,
}),
});
},
@@ -62,11 +62,11 @@ export default function MainLogin() {
store.dispatch(setStateLogin(true));
store.dispatch(setToken(data.accessToken));
store.dispatch(setToken(data.token));
store.dispatch(
setInfoUser({
accessToken: data?.accessToken || "",
accessToken: data?.token || "",
refreshToken: data?.refreshToken || "",
accessExpiresAt: data?.accessExpiresAt || "",
refreshExpiresAt: data?.refreshExpiresAt || "",
@@ -80,6 +80,7 @@ export default function MainLogin() {
setDataLoginStorage({
usernameStorage: form.username,
passwordStorage: form.password,
deviceIdStorage: form.deviceId,
}),
);
} else {
@@ -141,6 +142,25 @@ export default function MainLogin() {
icon={<User size={22} />}
/>
<div className="mt-5">
<InputForm
label={
<span>
deviceId
<span className="text-red-500"> *</span>
</span>
}
placeholder="deviceId"
type="text"
name="deviceId"
onClean
isRequired
isBlur
showDone
icon={<ShieldPlus size={22} />}
/>
</div>
{/* PASSWORD */}
<div className="mt-5">
<InputForm
@@ -202,42 +222,42 @@ export default function MainLogin() {
{/* BUTTONS */}
<div className="mt-6">
{/* LOGIN */}
<button
type="submit"
disabled={loginMutation.isPending}
className="
flex
h-[52px]
w-full
items-center
justify-center
rounded-full
bg-[#0011AB]
px-6
text-white
font-bold
transition-all
hover:opacity-90
disabled:cursor-not-allowed
disabled:opacity-50
"
>
Đăng nhập
</button>
<div className="flex gap-2">
{/* LOGIN */}
<CustomButton
variant="midnightBlue"
disabled={loginMutation.isPending}
rounded="full"
type="submit"
className="font-bold text-2xl disabled:cursor-not-allowed
disabled:opacity-50 h-[52px]"
>
Đăng nhập
</CustomButton>
{/* REGISTER */}
<CustomButton
variant="default"
rounded="full"
className="font-bold text-2xl disabled:cursor-not-allowed
disabled:opacity-50 h-[52px]"
onClick={() => router.push(PATH.REGISTER)}
>
Đăng
</CustomButton>
</div>
{/* LINE */}
<div
{/* <div
className="
my-5
h-[1px]
w-full
bg-[#E5E5E5]
"
/>
/> */}
{/* FORGOT PASSWORD */}
<button
{/* <button
type="button"
onClick={() => router.push(PATH.FORGOT_PASSWORD)}
className="
@@ -260,7 +280,7 @@ export default function MainLogin() {
>
<LockKeyhole size={22} />
Quên mật khẩu
</button>
</button> */}
</div>
</div>
</FormCustom>