세금 계산서 및 달력 월 형태 수정
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_USER } from '@/shared/api/api-url-user';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { NiceAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
BusinessPropertyByMidParams,
|
||||
BusinessPropertyByMidResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const businessPropertyByMid = (params: BusinessPropertyByMidParams) => {
|
||||
return resultify(
|
||||
axios.post<BusinessPropertyByMidResponse>(API_URL_USER.businessPropertyByMid(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useBusinessPropertyByMidMutation = (options?: UseMutationOptions<BusinessPropertyByMidResponse, NiceAxiosError, BusinessPropertyByMidParams>) => {
|
||||
const mutation = useMutation<BusinessPropertyByMidResponse, NiceAxiosError, BusinessPropertyByMidParams>({
|
||||
...options,
|
||||
mutationFn: (params: BusinessPropertyByMidParams) => businessPropertyByMid(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -1,12 +1,15 @@
|
||||
import { lens } from '@dhmk/zustand-lens';
|
||||
import { SetStateAction } from 'react';
|
||||
import { UserFavorite, UserInfo } from './types';
|
||||
import { BusinessInfo, UserFavorite, UserInfo } from './types';
|
||||
import { StorageKeys } from '@/shared/constants/local-storage';
|
||||
|
||||
export interface UserInfoState {
|
||||
userInfo: UserInfo;
|
||||
setUserInfo: (update: SetStateAction<Partial<UserInfo>>) => void;
|
||||
resetUserInfo: () => void;
|
||||
businessInfo: BusinessInfo;
|
||||
setBusinessInfo: (update: SetStateAction<Partial<BusinessInfo>>) => void;
|
||||
|
||||
userFavorite: Array<UserFavorite>;
|
||||
setUserFavorite: (update: SetStateAction<Array<UserFavorite>>) => void;
|
||||
userMids: Array<string>;
|
||||
@@ -21,6 +24,7 @@ export interface UserInfoState {
|
||||
|
||||
const initialUserInfoState = {
|
||||
userInfo: {} as UserInfo,
|
||||
businessInfo: {} as BusinessInfo,
|
||||
userFavorite: [] as Array<UserFavorite>,
|
||||
userMids: [] as Array<string>,
|
||||
selectOptionsMids: [] as Array<Record<string, string>>,
|
||||
@@ -43,6 +47,19 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
|
||||
};
|
||||
});
|
||||
},
|
||||
setBusinessInfo: (update) => {
|
||||
set((state: UserInfoState) => {
|
||||
const newBusinessInfo = (typeof update === 'function')
|
||||
? update(state.businessInfo): update;
|
||||
return {
|
||||
...state,
|
||||
businessInfo: {
|
||||
...state.businessInfo,
|
||||
...newBusinessInfo
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
resetUserInfo: () => {
|
||||
window.localStorage.removeItem(StorageKeys.TokenType);
|
||||
window.localStorage.removeItem(StorageKeys.AccessToken);
|
||||
|
||||
@@ -259,4 +259,15 @@ export interface ShortcutUserParams {
|
||||
export interface ShortcutUserResponse {
|
||||
shortcuts: Array<Shortcuts>;
|
||||
usingDefault: boolean;
|
||||
};
|
||||
|
||||
export interface BusinessPropertyByMidParams {
|
||||
mid: string;
|
||||
};
|
||||
export interface BusinessPropertyByMidResponse {
|
||||
companyNumber: string;
|
||||
businessScaleTypeName: string;
|
||||
};
|
||||
export interface BusinessInfo extends BusinessPropertyByMidResponse {
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user