diff --git a/src/commons/Input.tsx b/src/commons/Input.tsx index 7b4bd176..8bf9bebe 100644 --- a/src/commons/Input.tsx +++ b/src/commons/Input.tsx @@ -8,11 +8,13 @@ const Input = ({ onChange, autocomplete, defaultValue, + dataInputType, }: InputGroupProps) => { return ( ) => void; autocomplete?: string; + dataInputType?: string; } const InputGroup = ({ @@ -18,6 +19,7 @@ const InputGroup = ({ onChange, autocomplete, defaultValue, + dataInputType, }: InputGroupProps) => { return ( @@ -26,6 +28,7 @@ const InputGroup = ({ { @@ -15,11 +15,6 @@ const UserDropdownBox = () => { setIsDropdownOpen(!isDropdownOpen); }; - const removeToken = () => { - removeCookie('loginToken'); - removeCookie('userAccountInfo'); - }; - const handleOptionClick = (option: string) => { switch (option) { case 'My 정보 변경': diff --git a/src/commons/UserToggleBox.tsx b/src/commons/UserToggleBox.tsx index 867a155d..e4358a8f 100644 --- a/src/commons/UserToggleBox.tsx +++ b/src/commons/UserToggleBox.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import { getCookie, removeCookie, setCookie } from './cookie/cookie'; +import { getCookie, removeToken, setCookie } from './cookie/cookie'; const UserToggleBox = () => { const token = getCookie('loginToken'); @@ -13,11 +13,6 @@ const UserToggleBox = () => { setTabVisible(!isTabVisible); }; - const removeToken = () => { - removeCookie('loginToken'); - removeCookie('userAccountInfo'); - }; - const handleOptionClick = (option: string) => { switch (option) { case 'My 정보 변경': diff --git a/src/commons/cookie/cookie.ts b/src/commons/cookie/cookie.ts index 9dc430b8..5e09d48f 100644 --- a/src/commons/cookie/cookie.ts +++ b/src/commons/cookie/cookie.ts @@ -2,7 +2,16 @@ import { Cookies } from 'react-cookie'; const cookies = new Cookies(); -export const setCookie = (name: string, value: string, option?: any) => { +type CookieSetOptions = { + expires?: Date; + maxAge?: number; +}; + +export const setCookie = ( + name: string, + value: string, + option?: CookieSetOptions, +) => { return cookies.set(name, value, { ...option }); }; @@ -14,3 +23,8 @@ export const getCookie = (name: string) => { export const removeCookie = (name: string) => { return cookies.remove(name); }; + +export const removeToken = () => { + removeCookie('loginToken'); + removeCookie('userAccountInfo'); +}; diff --git a/src/commons/modals/LoginGuideModal.tsx b/src/commons/modals/LoginGuideModal.tsx index 8da0cc54..178e8a7c 100644 --- a/src/commons/modals/LoginGuideModal.tsx +++ b/src/commons/modals/LoginGuideModal.tsx @@ -34,7 +34,7 @@ const LoginGuideModal = () => { @@ -61,6 +53,7 @@ const VSignupInputForm = ({