260714_01_ENH: 테스트 서버에서 기동 후 중간 테스트를 위한 커밋
This commit is contained in:
@@ -4,17 +4,13 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { nextApi } from "@/lib/http-client";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||
import { useStorage } from "@/hooks/useStorage";
|
||||
import { StorageKeys } from "@/store/storage/storage-keys";
|
||||
import type { LoginUser } from "@/types/auth";
|
||||
import type { LoginUser } from "@kri/common";
|
||||
|
||||
export const useLoginMutation = () => {
|
||||
const { setFromLoginResponse } = useAuth();
|
||||
const { set: setSeat } = useStorage(StorageKeys.SeatNumber);
|
||||
const { set: setLoginType } = useStorage(StorageKeys.LoginType);
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (v: { userId: string; userPw: string; seatNum: string; loginType: string }) => {
|
||||
mutationFn: async (v: { userId: string; userPw: string }) => {
|
||||
return nextApi.post<LoginUser>(
|
||||
"/login",
|
||||
{ userId: v.userId, userPw: v.userPw },
|
||||
@@ -25,12 +21,8 @@ export const useLoginMutation = () => {
|
||||
},
|
||||
);
|
||||
},
|
||||
onSuccess: (data, v) => {
|
||||
try {
|
||||
setSeat(v.seatNum);
|
||||
setLoginType(v.loginType);
|
||||
} catch {}
|
||||
setFromLoginResponse(data, v.seatNum);
|
||||
onSuccess: (data) => {
|
||||
setFromLoginResponse(data);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -39,7 +31,6 @@ export const useLogoutMutation = () => {
|
||||
const qc = useQueryClient();
|
||||
const { auth, logout } = useAuth();
|
||||
const { clearSelectedProject } = useSelectedProject();
|
||||
const { get: getLoginType } = useStorage(StorageKeys.LoginType);
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async () => {
|
||||
@@ -55,7 +46,6 @@ export const useLogoutMutation = () => {
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
return { loginType: getLoginType() };
|
||||
},
|
||||
onSettled: () => {
|
||||
clearSelectedProject();
|
||||
|
||||
Reference in New Issue
Block a user