diff --git a/src/common/commonApi.js b/src/common/commonApi.js new file mode 100644 index 0000000..66cf53b --- /dev/null +++ b/src/common/commonApi.js @@ -0,0 +1,38 @@ +/* + 작성자 : 박지윤 + 작성일 : 2025-02-04 + 수정자 : + 수정일 : + 설명 : 공통 api +*/ +import { ref, onMounted } from "vue"; +import $api from '@api'; + +const commonApi = () => { + const colorList = ref([]); + const mbtiList = ref([]); + const pwhintList = ref([]); + + const CommonCode = async (endpoint, targetList) => { + try { + const response = await $api.get(`/user/${endpoint}`); + targetList.value = response.data.data.map(item => ({ + label: item.CMNCODNAM, + value: item.CMNCODVAL + })); + } catch (error) { + console.error(`Error fetching ${endpoint}:`, error); + targetList.value = []; + } + }; + + onMounted(async () => { + await CommonCode("color", colorList); + await CommonCode("mbti", mbtiList); + await CommonCode("pwhint", pwhintList); + }); + + return { colorList, mbtiList, pwhintList }; +}; + +export default commonApi; diff --git a/src/components/input/FormSelect.vue b/src/components/input/FormSelect.vue index 43c41b5..2ff0c3a 100644 --- a/src/components/input/FormSelect.vue +++ b/src/components/input/FormSelect.vue @@ -16,7 +16,7 @@ diff --git a/src/components/input/UserFormInput.vue b/src/components/input/UserFormInput.vue index 54024ec..e0a9e78 100644 --- a/src/components/input/UserFormInput.vue +++ b/src/components/input/UserFormInput.vue @@ -23,6 +23,7 @@ :id="name" class="form-control" :type="type" + :max="type === 'date' ? today : null" @input="updateInput" :value="computedValue" :maxLength="maxlength" diff --git a/src/components/user/FindPassword.vue b/src/components/user/FindPassword.vue index e69de29..77a8666 100644 --- a/src/components/user/FindPassword.vue +++ b/src/components/user/FindPassword.vue @@ -0,0 +1,173 @@ + + + diff --git a/src/components/user/LoginForm.vue b/src/components/user/LoginForm.vue index 71a9b1d..3727703 100644 --- a/src/components/user/LoginForm.vue +++ b/src/components/user/LoginForm.vue @@ -25,7 +25,7 @@
- +
등록신청 @@ -40,11 +40,17 @@ import router from '@/router'; import { ref } from 'vue'; import UserFormInput from '@c/input/UserFormInput.vue'; + import { useUserStore } from '@s/useUserStore'; + import { useToastStore } from '@s/toastStore'; const id = ref(''); const password = ref(''); const idAlert = ref(false); const passwordAlert = ref(false); + const remember = ref(false); + + const userStore = useUserStore(); + const toastStore = useToastStore(); const handleIdChange = value => { id.value = value; @@ -57,21 +63,19 @@ }; const handleSubmit = async () => { + const response = await $api.post('user/login', { + loginId: id.value, + password: password.value, + remember: remember.value, + }); - try { - const response = await $api.post('user/login', { - loginId: id.value, - password: password.value, - remember: false, - }); - - if (response.status === 200) { - console.log('로그인 성공', response.data); - router.push('/'); - } - } catch (error) { - console.error('로그인 실패', error); + if (response.status === 200) { + await userStore.userInfo(); + router.push('/'); + } else { + toastStore.onToast('아이디 혹은 비밀번호가 틀렸습니다.', 'e'); } + }; diff --git a/src/components/user/LogoHeader.vue b/src/components/user/LogoHeader.vue index 243842f..aa9905a 100644 --- a/src/components/user/LogoHeader.vue +++ b/src/components/user/LogoHeader.vue @@ -17,7 +17,7 @@ /> -

{{ title }}

+

{{ title }}

diff --git a/src/components/user/RegisterForm.vue b/src/components/user/RegisterForm.vue index 7aa5e86..64a0395 100644 --- a/src/components/user/RegisterForm.vue +++ b/src/components/user/RegisterForm.vue @@ -58,9 +58,11 @@ :is-essential="true" :is-row="false" :is-label="true" + :is-common="true" :data="pwhintList" @update:data="pwhint = $event" /> + diff --git a/src/layouts/TheTop.vue b/src/layouts/TheTop.vue index c5cb75e..1a664a7 100644 --- a/src/layouts/TheTop.vue +++ b/src/layouts/TheTop.vue @@ -8,161 +8,14 @@ - - - - -
  • @@ -413,9 +152,7 @@