diff --git a/package-lock.json b/package-lock.json index a06955bd..f37c9253 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "js-cookie": "^3.0.5", "pinia": "^2.3.0", "tailwind-scrollbar-hide": "^2.0.0", + "v3-infinite-loading": "^1.3.2", "vue": "^3.5.13", "vue-chartjs": "^5.3.2", "vue-router": "^4.5.0", @@ -5653,6 +5654,12 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "license": "MIT" }, + "node_modules/v3-infinite-loading": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/v3-infinite-loading/-/v3-infinite-loading-1.3.2.tgz", + "integrity": "sha512-2Bg8X8nqd9tKEOJdITABtuX2BMSYo/t+eZOAD+9/xz0fGyGDclglmWjo9Zs4dr/T63liO7EniBAunBesM2QhBA==", + "license": "MIT" + }, "node_modules/vite": { "version": "6.0.7", "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.7.tgz", diff --git a/package.json b/package.json index 4adbec52..c293994b 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "js-cookie": "^3.0.5", "pinia": "^2.3.0", "tailwind-scrollbar-hide": "^2.0.0", + "v3-infinite-loading": "^1.3.2", "vue": "^3.5.13", "vue-chartjs": "^5.3.2", "vue-router": "^4.5.0", diff --git a/src/api/auth.ts b/src/api/auth.ts index bafbad6c..653a443f 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -1,8 +1,10 @@ import { axiosInstance } from '@/utils/axios' import Cookies from 'js-cookie' import type { loginDataTypes } from '@/types/auth' +import { useMemberStore } from '@/stores/member' export const postLogin = async (loginData: loginDataTypes, sessionId: string) => { + const memberStore = useMemberStore() const response = await axiosInstance.post('/api/auths/login', loginData, { headers: { sessionId: sessionId } }) @@ -10,19 +12,33 @@ export const postLogin = async (loginData: loginDataTypes, sessionId: string) => path: '/', sameSite: 'strict' }) + Cookies.set('refreshToken', response.data.refreshToken, { + path: '/', + sameSite: 'strict' + }) + + await memberStore.updateMemberInfoWithToken() return response.data } export const patchPassword = async (password: string) => { - const accessToken = Cookies.get('accessToken') + const response = await axiosInstance.patch('/api/members/password', password) - if (!accessToken) return + return response.data +} + +export const deleteLogout = async () => { + const memberStore = useMemberStore() + const refreshToken = Cookies.get('refreshToken') - const response = await axiosInstance.patch('/api/members/password', password, { + const response = await axiosInstance.delete('/api/auths/logout', { headers: { - Authorization: `Bearer ${accessToken}` + Authorization: `Bearer ${import.meta.env.VITE_ACCESS_TOKEN}`, + refreshToken: refreshToken } }) - - return response.data + Cookies.remove('accessToken', { path: '/' }) + Cookies.remove('refreshToken', { path: '/' }) + await memberStore.updateMemberInfoWithToken() + return response } diff --git a/src/api/common.ts b/src/api/common.ts index 2cdf19a5..73c05ae7 100644 --- a/src/api/common.ts +++ b/src/api/common.ts @@ -1,5 +1,23 @@ import { axiosInstance } from '../utils/axios' +export const getNotification = async (pageNum: number, sizeNum: number) => { + const response = await axiosInstance.get(`/api/notifications?page=${pageNum}&size=${sizeNum}`) + + return response.data +} + +export const patchNotificationRead = async (notificationId: number) => { + const response = await axiosInstance.patch(`/api/notification/${notificationId}`) + console.log(notificationId) + return response.data +} + +export const getNotifiCount = async () => { + const response = await axiosInstance.get(`/api/notifications/count`) + console.log(response.data) + return response.data +} + export const getMainCategory = async () => { const response = await axiosInstance.get('/api/main-category') return response.data diff --git a/src/components/EditInformation.vue b/src/components/EditInformation.vue index be33be70..549368a1 100644 --- a/src/components/EditInformation.vue +++ b/src/components/EditInformation.vue @@ -16,7 +16,7 @@ class="w-24 h-24 rounded-full object-cover border mt-3" />
+ class="w-24 h-24 rounded-full bg-background-1 flex items-center justify-center mt-3">변경
@@ -91,7 +91,7 @@ const memberId = ref('Chole.yeon') const memberEmail = ref('taskflow123@gachon.ac.kr') const memberDepartment = ref('인프라팀') const memberJob = ref('인프라 아키텍처') -const imageUrl = ref('../../public/images/mockProfile.jpg') +const imageUrl = ref('') const isModalVisible = ref(false) const memberForm = ref({ diff --git a/src/components/top-bar/NotificationModal.vue b/src/components/top-bar/NotificationModal.vue index 70378eca..9027748c 100644 --- a/src/components/top-bar/NotificationModal.vue +++ b/src/components/top-bar/NotificationModal.vue @@ -7,7 +7,7 @@ class="flex relative w-[1200px] h-[72px] bg-opacity-15" @click.self="closeModal">알림