Skip to content

Commit bf84f6c

Browse files
committed
Merge branch 'develop' into Feat/131/DesignGatheringsFix
2 parents 93b3bb5 + 5e60ec4 commit bf84f6c

File tree

69 files changed

+1348
-640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1348
-640
lines changed

package-lock.json

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727
"@storybook/test": "^8.3.5",
2828
"@tanstack/react-query": "^5.59.16",
2929
"@tanstack/react-query-next-experimental": "^5.59.19",
30+
"@vercel/speed-insights": "^1.1.0",
3031
"dayjs": "^1.11.13",
3132
"embla-carousel-react": "^7.1.0",
3233
"framer-motion": "^11.11.9",
3334
"next": "14.2.15",
3435
"react": "^18",
3536
"react-dom": "^18",
3637
"react-hook-form": "^7.53.1",
38+
"react-hook-form-persist": "^3.0.0",
3739
"react-intersection-observer": "^9.13.1",
3840
"react-toastify": "^10.0.6",
3941
"zustand": "^5.0.1"
Lines changed: 6 additions & 0 deletions
Loading

public/assets/icons/ic-edit.svg

Lines changed: 4 additions & 0 deletions
Loading

public/assets/icons/ic-email.svg

Lines changed: 5 additions & 0 deletions
Loading

public/assets/icons/ic-share.svg

Lines changed: 5 additions & 0 deletions
Loading

public/assets/icons/profile-edit.svg

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/_apis/auth/user-apis.ts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,52 @@
11
import { fetchApi } from '@/src/utils/api';
22
import { User } from '@/src/types/auth';
33

4-
export function getUser(): Promise<{ data: User }> {
4+
export function getUser(): Promise<User> {
55
return fetchApi<{ data: User }>('/auths/user', {
66
method: 'GET',
77
headers: {
88
'Content-Type': 'application/json',
99
},
10+
}).then((response) => response.data);
11+
}
12+
13+
// 회원정보 수정
14+
export async function updateUserProfile(file: File): Promise<void> {
15+
const url = `/auths/user`;
16+
17+
const formData = new FormData();
18+
formData.append('file', file);
19+
20+
await fetchApi(url, {
21+
method: 'PUT',
22+
body: formData,
23+
});
24+
}
25+
26+
export async function fetchUpdatedUser() {
27+
return fetchApi<{ data: User }>('/auths/user', {
28+
method: 'GET',
29+
headers: {
30+
'Content-Type': 'application/json',
31+
'Cache-Control': 'no-cache',
32+
},
33+
})
34+
.then((response) => {
35+
return response.data;
36+
})
37+
.catch((error) => {
38+
throw error;
39+
});
40+
}
41+
42+
// 유저 프로필 이미지 초기화
43+
export async function resetUserProfileImage(): Promise<void> {
44+
const url = `/auths/profile-image/reset`;
45+
46+
await fetchApi(url, {
47+
method: 'PUT',
48+
headers: {
49+
'Content-Type': 'application/json',
50+
},
1051
});
1152
}

src/_apis/crew/crew-detail-apis.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { fetchApi } from '@/src/utils/api';
22
import { CrewDetail } from '@/src/types/crew-card';
33

4+
// 크루 디테일 보기
45
export async function getCrewDetail(id: number): Promise<CrewDetail> {
56
const url = `/api/crews/${id}`;
67

@@ -12,3 +13,39 @@ export async function getCrewDetail(id: number): Promise<CrewDetail> {
1213
});
1314
return response.data;
1415
}
16+
17+
// 크루 참여
18+
export async function joinCrew(crewId: number): Promise<void> {
19+
const url = `/api/crews/${crewId}/join`;
20+
21+
await fetchApi<void>(url, {
22+
method: 'POST',
23+
headers: {
24+
'Content-Type': 'application/json',
25+
},
26+
});
27+
}
28+
29+
// 사용자 크루 탈퇴
30+
export async function leaveCrew(crewId: number): Promise<void> {
31+
const url = `/api/crews/${crewId}/leave`;
32+
33+
await fetchApi<void>(url, {
34+
method: 'DELETE',
35+
headers: {
36+
'Content-Type': 'application/json',
37+
},
38+
});
39+
}
40+
41+
// 주최자 크루 취소
42+
export async function cancelCrew(crewId: number): Promise<void> {
43+
const url = `/api/crews/${crewId}`;
44+
45+
await fetchApi<void>(url, {
46+
method: 'DELETE',
47+
headers: {
48+
'Content-Type': 'application/json',
49+
},
50+
});
51+
}

src/_apis/crew/crew.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import { fetchApi } from '@/src/utils/api';
2-
import { CreateCrewRequestTypes, CreateCrewResponseTypes } from '@/src/types/create-crew';
2+
import {
3+
CreateCrewRequestTypes,
4+
CreateCrewResponseTypes,
5+
EditCrewRequestTypes,
6+
EditCrewResponseTypes,
7+
} from '@/src/types/create-crew';
38

49
export async function createCrew(data: CreateCrewRequestTypes) {
510
try {
6-
const response: { data: CreateCrewResponseTypes; status: number } = await fetchApi(
7-
`/api/crews`,
8-
{
9-
method: 'POST',
10-
headers: {
11-
'Content-Type': 'application/json',
12-
},
13-
credentials: 'include', // Include authentication credentials
14-
body: JSON.stringify(data),
11+
const response: { data: CreateCrewResponseTypes } = await fetchApi(`/api/crews`, {
12+
method: 'POST',
13+
headers: {
14+
'Content-Type': 'application/json',
1515
},
16-
);
16+
credentials: 'include', // Include authentication credentials
17+
body: JSON.stringify(data),
18+
});
1719
if (!response.data) {
1820
throw new Error('Failed to create crew: No data received');
1921
}
@@ -23,3 +25,18 @@ export async function createCrew(data: CreateCrewRequestTypes) {
2325
throw error;
2426
}
2527
}
28+
29+
export async function editCrew(id: number, data: EditCrewRequestTypes) {
30+
try {
31+
await fetchApi(`/api/crews/${id}`, {
32+
method: 'PUT',
33+
headers: {
34+
'Content-Type': 'application/json',
35+
},
36+
credentials: 'include', // Include authentication credentials
37+
body: JSON.stringify(data),
38+
});
39+
} catch (error) {
40+
throw error;
41+
}
42+
}

0 commit comments

Comments
 (0)