Merge remote-tracking branch 'origin/main' into board-view-content

This commit is contained in:
kimdaae328 2025-02-11 14:59:59 +09:00
commit 8d3ddf1973
3 changed files with 11 additions and 5 deletions

View File

@ -74,7 +74,7 @@
<script src="/vendor/libs/hammer/hammer.js"></script> <script src="/vendor/libs/hammer/hammer.js"></script>
<script src="/vendor/libs/i18n/i18n.js"></script> <script src="/vendor/libs/i18n/i18n.js"></script>
<script src="/vendor/libs/typeahead-js/typeahead.js"></script> <script src="/vendor/libs/typeahead-js/typeahead.js"></script>
<!-- <script src="/vendor/js/menu.js"></script> --> <script src="/vendor/js/menu.js"></script>
<!-- endbuild --> <!-- endbuild -->
<!-- Vendors JS --> <!-- Vendors JS -->

View File

@ -1,4 +1,5 @@
import axios from "axios"; import axios from "axios";
import { useRoute } from 'vue-router';
import { useToastStore } from '@s/toastStore'; import { useToastStore } from '@s/toastStore';
const $api = axios.create({ const $api = axios.create({
@ -37,11 +38,16 @@ $api.interceptors.response.use(
}, },
function (error) { function (error) {
const toastStore = useToastStore() const toastStore = useToastStore()
const currentPage = error.config.headers['X-Page-Route'];
// 오류 응답 처리 // 오류 응답 처리
if (error.response) { if (error.response) {
switch (error.response.status) { switch (error.response.status) {
case 401: case 401:
toastStore.onToast('아이디 혹은 비밀번호가 틀렸습니다.', 'e'); if (currentPage === '/login') {
toastStore.onToast('아이디 혹은 비밀번호가 틀렸습니다.', 'e');
} else {
toastStore.onToast('인증이 필요합니다.', 'e');
}
break; break;
case 403: case 403:
toastStore.onToast('접근 권한이 없습니다.', 'e'); toastStore.onToast('접근 권한이 없습니다.', 'e');

View File

@ -38,10 +38,10 @@
<script setup> <script setup>
import $api from '@api'; import $api from '@api';
import router from '@/router'; import router from '@/router';
import { useRoute } from 'vue-router';
import { ref } from 'vue'; import { ref } from 'vue';
import UserFormInput from '@c/input/UserFormInput.vue'; import UserFormInput from '@c/input/UserFormInput.vue';
import { useUserStore } from '@s/useUserStore'; import { useUserStore } from '@s/useUserStore';
import { useToastStore } from '@s/toastStore';
const id = ref(''); const id = ref('');
const password = ref(''); const password = ref('');
@ -50,7 +50,7 @@
const remember = ref(false); const remember = ref(false);
const userStore = useUserStore(); const userStore = useUserStore();
const toastStore = useToastStore(); const route = useRoute();
const handleIdChange = value => { const handleIdChange = value => {
id.value = value; id.value = value;
@ -67,7 +67,7 @@
loginId: id.value, loginId: id.value,
password: password.value, password: password.value,
remember: remember.value, remember: remember.value,
}) }, { headers: { 'X-Page-Route': route.path } })
.then(res => { .then(res => {
if (res.status === 200) { if (res.status === 200) {
userStore.userInfo(); userStore.userInfo();