From 09dd262fde7879c69a4c1330b7346cd74a66f310 Mon Sep 17 00:00:00 2001 From: jiyeon Date: Sun, 2 Feb 2025 14:45:53 +0900 Subject: [PATCH 01/28] =?UTF-8?q?=E2=9C=A8=20=20[feat]=20:=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20API=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth.ts | 20 ++++++++++++++++++++ src/views/LoginView.vue | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/api/auth.ts diff --git a/src/api/auth.ts b/src/api/auth.ts new file mode 100644 index 00000000..d97a9443 --- /dev/null +++ b/src/api/auth.ts @@ -0,0 +1,20 @@ +import axiosInstance from '@/utils/axios' + +export const postLogin = async (nickname: string, password: string) => { + const body = { + nickname: nickname, + password: password + } + const sessionIdValue = '123' + try { + const response = await axiosInstance.post('/api/auths/login', body, { + headers: { + sessionId: sessionIdValue + } + }) + return response.data + } catch (error) { + console.error('로그인 오류:', error) + throw error + } +} diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue index 0566f00e..49070bb4 100644 --- a/src/views/LoginView.vue +++ b/src/views/LoginView.vue @@ -46,11 +46,13 @@ From 89d9fa741607a89ff3180c227b26c05189903318 Mon Sep 17 00:00:00 2001 From: jiyeon Date: Sun, 2 Feb 2025 17:18:41 +0900 Subject: [PATCH 02/28] =?UTF-8?q?=E2=9C=A8=20=20[feat]=20:=20=EC=95=A1?= =?UTF-8?q?=EC=84=B8=EC=8A=A4=20=ED=86=A0=ED=81=B0=20=EC=BF=A0=ED=82=A4?= =?UTF-8?q?=EC=97=90=20=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/api/auth.ts b/src/api/auth.ts index d97a9443..3447d4d0 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -1,4 +1,5 @@ import axiosInstance from '@/utils/axios' +import Cookies from 'js-cookie' export const postLogin = async (nickname: string, password: string) => { const body = { @@ -12,6 +13,12 @@ export const postLogin = async (nickname: string, password: string) => { sessionId: sessionIdValue } }) + + Cookies.set('accessToken', response.data.accessToken, { + path: '/', + sameSite: 'strict' + }) + return response.data } catch (error) { console.error('로그인 오류:', error) From 0f024ee27f3f09bc826e142f8c1e52613c8be1eb Mon Sep 17 00:00:00 2001 From: jiyeon Date: Sun, 2 Feb 2025 17:18:56 +0900 Subject: [PATCH 03/28] =?UTF-8?q?=E2=9C=A8=20=20[feat]=20:=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=8B=9C=20=EA=B0=81=20=EC=97=AD=ED=95=A0?= =?UTF-8?q?=EB=A7=88=EB=8B=A4=20=EA=B2=BD=EB=A1=9C=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/LoginView.vue | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue index 49070bb4..caf6bfaa 100644 --- a/src/views/LoginView.vue +++ b/src/views/LoginView.vue @@ -46,13 +46,36 @@ From d8712e279e055924432a60f1b4958d1ae249e220 Mon Sep 17 00:00:00 2001 From: jiyeon Date: Sun, 2 Feb 2025 19:52:03 +0900 Subject: [PATCH 04/28] =?UTF-8?q?=E2=9C=A8=20=20[feat]=20:=20Pinia=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=EC=A0=95=EB=B3=B4=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=EC=83=81=ED=83=9C=EA=B4=80=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/member.ts | 61 ++++++++++++++++++++++++++++++++++++++++++++ src/types/auth.ts | 9 +++++++ 2 files changed, 70 insertions(+) create mode 100644 src/stores/member.ts diff --git a/src/stores/member.ts b/src/stores/member.ts new file mode 100644 index 00000000..72646809 --- /dev/null +++ b/src/stores/member.ts @@ -0,0 +1,61 @@ +// stores/memberStore.ts +import { defineStore } from 'pinia' +import axiosInstance from '@/utils/axios' +import { ref } from 'vue' +import type { User } from '@/types/auth' +import Cookies from 'js-cookie' + +export const useMemberStore = defineStore('memberInfo', () => { + const info = ref({ + memberId: 0, + memberName: '', + nickname: '', + imageUrl: '', + memberRole: '', + memberStatus: '' + }) + + // API 호출 후 회원 정보 업데이트 + async function updateMemberInfoWithToken() { + try { + const accessToken = Cookies.get('accessToken') + + if (!accessToken) { + console.error('Access token is missing') + return + } + + const response = await axiosInstance.get('/api/members/info', { + headers: { + Authorization: `Bearer ${accessToken}` + } + }) + + // 받은 데이터로 상태 업데이트 + console.log('API Response:', response.data) + updateMemberInfo(response.data) + } catch (error) { + console.error('Error fetching member info:', error) + } + } + + // 상태 업데이트 함수 + function updateMemberInfo(responseData: any) { + info.value = { + memberId: 0, + memberName: responseData.name || '', + nickname: responseData.nicknanme || '', + imageUrl: responseData.profileImageUrl || '', + memberRole: responseData.role || '', + memberStatus: '' + } + + console.log('Updated member info:', info.value) + } + + return { + info, + updateMemberInfo, + updateMemberInfoWithToken + } +}) diff --git a/src/types/auth.ts b/src/types/auth.ts index 8c5c5b14..2af35891 100644 --- a/src/types/auth.ts +++ b/src/types/auth.ts @@ -4,3 +4,12 @@ export interface UserTypes { created_at: string updated_at: string } + +export interface User { + memberId: number + memberName: string + nickname: string + imageUrl: string + memberRole: string + memberStatus: string +} From c3ae5cd13ffda33c7218a23d323f925038b6cedb Mon Sep 17 00:00:00 2001 From: jiyeon Date: Sun, 2 Feb 2025 19:52:34 +0900 Subject: [PATCH 05/28] =?UTF-8?q?=E2=9C=A8=20=20[feat]=20:=20Pinia?= =?UTF-8?q?=EC=97=90=20=EC=A0=80=EC=9E=A5=EB=90=9C=20=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20Top,=20Side=EC=97=90=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SideBar.vue | 24 +++++++++++++++++------- src/components/TopBar.vue | 23 +++++++++++++++++++---- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/components/SideBar.vue b/src/components/SideBar.vue index fe08f51f..5641e806 100644 --- a/src/components/SideBar.vue +++ b/src/components/SideBar.vue @@ -39,8 +39,14 @@
- -
+ 프로필 이미지 +

{{ name }}

{{ nickname }}

@@ -61,17 +67,21 @@ diff --git a/src/components/request-task/RequestTaskFileInput.vue b/src/components/request-task/RequestTaskFileInput.vue index 6ee08c50..74cc26b9 100644 --- a/src/components/request-task/RequestTaskFileInput.vue +++ b/src/components/request-task/RequestTaskFileInput.vue @@ -9,7 +9,7 @@ @change="handleFileUpload" />
() const emit = defineEmits(['update:modelValue']) -const hasFiles = computed(() => props.modelValue && props.modelValue.length > 0) +const hasFiles = computed(() => modelValue && modelValue.length > 0) const handleFileUpload = (event: Event) => { const target = event.target as HTMLInputElement if (target.files && target.files.length > 0) { const newFiles = Array.from(target.files) - const updatedFiles = props.modelValue ? [...props.modelValue, ...newFiles] : newFiles + const updatedFiles = modelValue ? [...modelValue, ...newFiles] : newFiles emit('update:modelValue', updatedFiles) } } const removeFile = (index: number) => { - if (props.modelValue) { - const updatedFiles = [...props.modelValue] + if (modelValue) { + const updatedFiles = [...modelValue] updatedFiles.splice(index, 1) emit('update:modelValue', updatedFiles) } diff --git a/src/components/task-management/CategoryAdd.vue b/src/components/task-management/CategoryAdd.vue index b0a0ca07..22686e00 100644 --- a/src/components/task-management/CategoryAdd.vue +++ b/src/components/task-management/CategoryAdd.vue @@ -42,10 +42,10 @@ import { CATEGORY_FIRST_ADD, CATEGORY_SECOND_ADD, RoleKeys } from '@/constants/admin' import { ref } from 'vue' import { useRouter } from 'vue-router' +import FormButtonContainer from '../common/FormButtonContainer.vue' import ModalView from '../ModalView.vue' import RequestTaskDropdown from '../request-task/RequestTaskDropdown.vue' import RequestTaskInput from '../request-task/RequestTaskInput.vue' -import FormButtonContainer from '../common/FormButtonContainer.vue' const router = useRouter() From 11462ed42ccf9c63e2dc3ba8a3c88564346e0ce5 Mon Sep 17 00:00:00 2001 From: Minkyu0424 Date: Sun, 2 Feb 2025 02:19:43 +0900 Subject: [PATCH 10/28] =?UTF-8?q?:recycle:=20[refactor]=20:=201,2=EC=B0=A8?= =?UTF-8?q?=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EC=84=A0=EC=96=B8=20=EB=B0=8F=20=EC=9C=84=EC=B9=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/admin.ts | 14 ++++---------- src/types/admin.ts | 17 ++--------------- src/types/common.ts | 27 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/constants/admin.ts b/src/constants/admin.ts index 197cb3e5..15fef027 100644 --- a/src/constants/admin.ts +++ b/src/constants/admin.ts @@ -1,4 +1,4 @@ -import type { ListBarTabProps, Option } from '@/types/common' +import type { ListBarTabProps, MainCategoryTypes, Option, SubCategoryTypes } from '@/types/common' export const MEMBER_MANAGEMENT_LIST_BAR_TAB: ListBarTabProps[] = [ { content: '이름', width: 60 }, @@ -34,21 +34,15 @@ export const LOGS_LIST_BAR_TAB: ListBarTabProps[] = [ { content: '결과' } ] -import type { - RoleTypes, - RoleTypesEnum, - UserRegistrationProps, - mainCategoryTypes, - subCategoryTypes -} from '@/types/admin' +import type { RoleTypes, RoleTypesEnum, UserRegistrationProps } from '@/types/admin' -export const CATEGORY_FIRST_ADD: mainCategoryTypes = { +export const CATEGORY_FIRST_ADD: MainCategoryTypes = { name: '', code: '', id: 0 } -export const CATEGORY_SECOND_ADD: subCategoryTypes = { +export const CATEGORY_SECOND_ADD: SubCategoryTypes = { name: '', mainCategoryId: 0, code: '', diff --git a/src/types/admin.ts b/src/types/admin.ts index 436b33f5..f266f587 100644 --- a/src/types/admin.ts +++ b/src/types/admin.ts @@ -1,4 +1,4 @@ -import type { Role } from './common' +import type { Role, SubCategoryTypes } from './common' export interface MemberManagementListData { memberId: number @@ -42,24 +42,11 @@ export interface CategoryLineProps { mainCategoryId?: string } -export interface mainCategoryTypes { - id: number - name: string - code: string -} - -export interface subCategoryTypes { - id: number - mainCategoryId: number - name: string - code: string -} - export interface categoriesTypes { id: number name: string code: string - subCategory: subCategoryTypes[] + subCategory: SubCategoryTypes[] } export interface CategoryAllData { diff --git a/src/types/common.ts b/src/types/common.ts index 92ae0f91..80574efa 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -72,3 +72,30 @@ export interface ColorSelectProps { selectedDivisionId: number | null isOpen: boolean } + +export interface LabelDataTypes { + labelId: number + labelName: string + labelColor: string +} + +export interface MainCategoryTypes { + id: number + name: string + code: string +} + +export interface SubCategoryTypes { + id: number + mainCategoryId: number + name: string + code: string +} + +export interface CategoryDropdownProps { + placeholderText: string + options: MainCategoryTypes[] | SubCategoryTypes[] + labelName: string + modelValue: string + isLabel?: boolean +} From 6a6b4a6f08ced934da51252a5de665bb09bff91c Mon Sep 17 00:00:00 2001 From: Minkyu0424 Date: Sun, 2 Feb 2025 03:07:11 +0900 Subject: [PATCH 11/28] =?UTF-8?q?:sparkles:=20[feat]=20:=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=EC=9A=A9=20=EB=93=9C=EB=A1=AD?= =?UTF-8?q?=EB=8B=A4=EC=9A=B4=20=EA=B0=9C=EB=B3=84=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request-task/CategoryDropDown.vue | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/components/request-task/CategoryDropDown.vue diff --git a/src/components/request-task/CategoryDropDown.vue b/src/components/request-task/CategoryDropDown.vue new file mode 100644 index 00000000..609ebdae --- /dev/null +++ b/src/components/request-task/CategoryDropDown.vue @@ -0,0 +1,57 @@ + + + From 61ed646525ec6806be696660ad98edd7f46cfbd3 Mon Sep 17 00:00:00 2001 From: Minkyu0424 Date: Sun, 2 Feb 2025 03:10:43 +0900 Subject: [PATCH 12/28] =?UTF-8?q?:sparkles:=20[feat]=20:=201,=202=EC=B0=A8?= =?UTF-8?q?=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?api=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/common.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/api/common.ts diff --git a/src/api/common.ts b/src/api/common.ts new file mode 100644 index 00000000..a0d4fd4e --- /dev/null +++ b/src/api/common.ts @@ -0,0 +1,11 @@ +import { axiosInstance } from '../utils/axios' + +export const getMainCategory = async () => { + const response = await axiosInstance.get('/api/main-category') + return response.data +} + +export const getSubCategory = async () => { + const response = await axiosInstance.get('/api/sub-category') + return response.data +} From d1a8a4156b757c1bffb89be174d98e7e97fd4fe3 Mon Sep 17 00:00:00 2001 From: Minkyu0424 Date: Sun, 2 Feb 2025 03:11:02 +0900 Subject: [PATCH 13/28] =?UTF-8?q?:sparkles:=20[feat]=20:=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=EC=83=9D=EC=84=B1=20api=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/request-task/RequestTask.vue | 53 ++++++++++++++------- src/types/common.ts | 3 +- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/components/request-task/RequestTask.vue b/src/components/request-task/RequestTask.vue index 18a84809..a91a8b4b 100644 --- a/src/components/request-task/RequestTask.vue +++ b/src/components/request-task/RequestTask.vue @@ -1,15 +1,17 @@