Skip to content

Commit

Permalink
refactor: camelCase 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
LJW25 committed Feb 10, 2024
1 parent 558cc18 commit 294ba78
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, Flex, Modal, Theme } from 'hang-log-design-system';

import { UseAddAdminMemberForm } from '@hooks/adminMember/useAddAdminMemberForm';
import { useAddAdminMemberForm } from '@hooks/adminMember/useAddAdminMemberForm';

import CloseIcon from '@assets/svg/close-icon.svg?react';

Expand Down Expand Up @@ -32,7 +32,7 @@ const AdminMemberAddModal = ({ isOpen = true, onClose }: AdminMemberAddModalProp
disableConfirmPasswordError,
updateInputValue,
handleSubmit,
} = UseAddAdminMemberForm({ onSuccess: onClose });
} = useAddAdminMemberForm({ onSuccess: onClose });

return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, Flex, Modal, Theme } from 'hang-log-design-system';

import { UseUpdatePasswordForm } from '@hooks/adminMember/useUpdatePasswordForm';
import { useUpdatePasswordForm } from '@hooks/adminMember/useUpdatePasswordForm';

import CloseIcon from '@assets/svg/close-icon.svg?react';

Expand Down Expand Up @@ -34,7 +34,7 @@ const PasswordUpdateModal = (
disableConfirmPasswordError,
updateInputValue,
handleSubmit,
} = UseUpdatePasswordForm({ adminMemberId: adminMemberId, onSuccess: onClose });
} = useUpdatePasswordForm({ adminMemberId: adminMemberId, onSuccess: onClose });

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Flex, Modal, Theme } from 'hang-log-design-system';

import { CategoryData } from '@type/category';

import { UseAddCategoryForm } from '@hooks/category/useAddCategoryForm';
import { useAddCategoryForm } from '@hooks/category/useAddCategoryForm';

import CloseIcon from '@assets/svg/close-icon.svg?react';

Expand Down Expand Up @@ -37,7 +37,7 @@ const CategoryAddModal = (
disableKorNameError,
updateInputValue,
handleSubmit,
} = UseAddCategoryForm({
} = useAddCategoryForm({
originalCategoryId,
initialData,
onSuccess: onClose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Flex, Modal, Theme } from 'hang-log-design-system';

import type { CityFormData } from '@type/city';

import { UseAddCityForm } from '@hooks/city/useAddCityForm';
import { useAddCityForm } from '@hooks/city/useAddCityForm';

import CloseIcon from '@assets/svg/close-icon.svg?react';

Expand Down Expand Up @@ -38,7 +38,7 @@ const CityAddModal = ({ cityId, initialData, isOpen = true, onClose }: CityAddMo
disableLongitudeError,
updateInputValue,
handleSubmit,
} = UseAddCityForm({
} = useAddCityForm({
cityId,
initialData,
onSuccess: onClose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Flex, Modal, Theme } from 'hang-log-design-system';

import type { CurrencyFormData } from '@type/currency';

import { UseAddCurrencyForm } from '@hooks/currency/useAddCurrencyForm';
import { useAddCurrencyForm } from '@hooks/currency/useAddCurrencyForm';

import { currencyKeys } from '@constants/currency';

Expand Down Expand Up @@ -36,7 +36,7 @@ const CurrencyAddModal = (
disableCurrencyError,
updateInputValue,
handleSubmit,
} = UseAddCurrencyForm({
} = useAddCurrencyForm({
currencyId,
initialData,
onSuccess: onClose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { isEmptyString, isValidPassword } from '@utils/validator';

import { useAddAdminMemberMutation } from '../api/useAddAdminMemberMutation';

interface UseAddAdminMemberFormParams {
interface useAddAdminMemberFormParams {
onSuccess?: () => void;
onError?: () => void;
}

export const UseAddAdminMemberForm = ({ onSuccess, onError }: UseAddAdminMemberFormParams) => {
export const useAddAdminMemberForm = ({ onSuccess, onError }: useAddAdminMemberFormParams) => {
const addAdminMemberMutaion = useAddAdminMemberMutation();

const [adminMemberInformation, setAdminMemberInformation] = useState<AdminMemberFormData>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { isEmptyString, isValidPassword } from '@utils/validator';

import { useUpdateAdminMemberPasswordMutation } from '../api/useUpdateAdminMemberPasswordMutation';

interface UseUpdatePasswordFormParams {
interface useUpdatePasswordFormParams {
adminMemberId: number;
onSuccess?: () => void;
onError?: () => void;
Expand All @@ -17,10 +17,10 @@ export interface PassowrdFormData extends PasswordPatchData {
confirmPassword: string;
}

export const UseUpdatePasswordForm = (
{ adminMemberId, onSuccess, onError }: UseUpdatePasswordFormParams
export const useUpdatePasswordForm = (
{ adminMemberId, onSuccess, onError }: useUpdatePasswordFormParams
) => {
const UpdatePasswordMutaion = useUpdateAdminMemberPasswordMutation();
const updatePasswordMutaion = useUpdateAdminMemberPasswordMutation();

const [adminMemberInformation, setAdminMemberInformation] = useState<PassowrdFormData>({
currentPassword: '',
Expand Down Expand Up @@ -76,7 +76,7 @@ export const UseUpdatePasswordForm = (
return;
}

UpdatePasswordMutaion.mutate(
updatePasswordMutaion.mutate(
{
adminMemberId: adminMemberId,
currentPassword: adminMemberInformation.currentPassword,
Expand All @@ -99,4 +99,4 @@ export const UseUpdatePasswordForm = (
};
};

export default UseUpdatePasswordForm;
export default useUpdatePasswordForm;
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { isEmptyString, isEnglish, isInvalidCategoryId, isKorean } from '@utils/
import { useAddCategoryMutation } from '../api/useAddCategoryMutation';
import { useUpdateCategoryMutation } from '../api/useUpdateCategoryMutation';

interface UseAddCategoryFormParams {
interface useAddCategoryFormParams {
originalCategoryId?: number;
initialData?: CategoryData;
onSuccess?: () => void;
onError?: () => void;
}

export const UseAddCategoryForm = (
{ originalCategoryId, initialData, onSuccess, onError }: UseAddCategoryFormParams
export const useAddCategoryForm = (
{ originalCategoryId, initialData, onSuccess, onError }: useAddCategoryFormParams
) => {
const addCategoryMutation = useAddCategoryMutation();
const updateCategoryMutation = useUpdateCategoryMutation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { isEmptyString, isInvalidLatitude, isInvalidLongitude } from '@utils/val
import { useAddCityMutation } from '../api/useAddCityMutation';
import { useUpdateCityMutation } from '../api/useUpdateCityMutation';

interface UseAddCityFormParams {
interface useAddCityFormParams {
cityId?: number;
initialData?: CityFormData;
onSuccess?: () => void;
onError?: () => void;
}

export const UseAddCityForm = (
{ cityId, initialData, onSuccess, onError }: UseAddCityFormParams
export const useAddCityForm = (
{ cityId, initialData, onSuccess, onError }: useAddCityFormParams
) => {
const addCityMutation = useAddCityMutation();
const updateCityMutation = useUpdateCityMutation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import { isInvalidCurrency, isValidCurrencyDate } from '@utils/validator';
import { useAddCurrencyMutation } from '../api/useAddCurrencyMutation';
import { useUpdateCurrencyMutation } from '../api/useUpdateCurrencyMutation';

interface UseAddCurrencyFormPrams {
interface useAddCurrencyFormPrams {
currencyId?: number;
initialData?: CurrencyFormData;
onSuccess?: () => void;
onError?: () => void;
}

export const UseAddCurrencyForm = (
{ currencyId, initialData, onSuccess, onError }: UseAddCurrencyFormPrams
export const useAddCurrencyForm = (
{ currencyId, initialData, onSuccess, onError }: useAddCurrencyFormPrams
) => {
const addCurrencyMutation = useAddCurrencyMutation();
const updateCurrencyMutation = useUpdateCurrencyMutation();
Expand Down Expand Up @@ -58,10 +58,6 @@ export const UseAddCurrencyForm = (
setIsDateError(false);
}, []);

// const checkCurrencyValidity = (currencyInformation: CurrencyFormData) => {
// return currencyKeys.some((key) => isInvalidCurrency(Number(currencyInformation[key])));
// };

const [currencyErrors, setCurrencyErrors] = useState<Record<string, boolean>>(
currencyKeys.reduce((acc, key) => {
acc[key] = false;
Expand Down Expand Up @@ -95,10 +91,6 @@ export const UseAddCurrencyForm = (
return;
}

// if (checkCurrencyValidity(currencyInformation)) {
// setIsCurrencyError(true);
// return;
// }
const isAnyCurrencyInvalid = checkAndSetCurrencyValidity();
if (isAnyCurrencyInvalid) {
return;
Expand Down

0 comments on commit 294ba78

Please sign in to comment.