Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

내 공고 폴더 내부 구현 #40

Merged
merged 68 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c08df09
feat: semester selector
eunbeann Aug 22, 2024
55cb010
feat: application status
eunbeann Aug 22, 2024
47b86bf
feat: add DetailHeader
eunbeann Aug 22, 2024
17edfd6
feat: add TextBubble
eunbeann Aug 22, 2024
7755182
feat: add detailContent
eunbeann Aug 22, 2024
5fca049
feat: add Page file
eunbeann Aug 22, 2024
a22b2bd
style: header on top
eunbeann Aug 22, 2024
cb42bed
fix: refresh 수정
eunbeann Aug 24, 2024
65aea6c
style:Change DateDialog Style
eunbeann Aug 24, 2024
dc38bf3
move: change directory
eunbeann Aug 24, 2024
be3bb3c
feat: add APIs
eunbeann Aug 24, 2024
f0aeac0
feat: add TagList
eunbeann Aug 24, 2024
3111777
fix: fix invalidateQueries
eunbeann Aug 24, 2024
1da0d27
feat: add GetRecruitByID
eunbeann Aug 24, 2024
c6a9d49
feat: addTypes
eunbeann Aug 24, 2024
0b9a0ad
apis: changedAPI
eunbeann Aug 24, 2024
1f4c84c
add: add RefreshIcon
eunbeann Aug 24, 2024
7058bc2
feat(editor): 에디터 API 연결 (#27)
Collection50 Aug 24, 2024
5234fb5
FIX
Collection50 Aug 24, 2024
848dc60
feat(editor): memo 구현 (#30)
Collection50 Aug 24, 2024
e6f6993
feat(my-info): 내 정보 페이지 API 연동 (#29)
woo-jk Aug 24, 2024
8046e24
FIX
Collection50 Aug 24, 2024
4f1fc9b
PUSH
Collection50 Aug 24, 2024
5d9e0eb
docs: add env to gitignore
eunbeann Aug 24, 2024
300107c
feat: queryParameter
eunbeann Aug 24, 2024
c4ac4f4
feat: fix sth
eunbeann Aug 24, 2024
9ed1ee0
feat(my-recruit): 내 공고 뽀각 페이지 api 연결 (#28)
qkrdmstlr3 Aug 24, 2024
732fe28
style:Change DateDialog Style
eunbeann Aug 24, 2024
188b4cc
apis: changedAPI
eunbeann Aug 24, 2024
18a429d
feat: fix sth
eunbeann Aug 24, 2024
52fe24b
fix: conflict eror fix
eunbeann Aug 25, 2024
07dc1df
feat(my-info): 내 정보 페이지 API 연동 (#29)
woo-jk Aug 24, 2024
2df3079
update background (#31)
qkrdmstlr3 Aug 24, 2024
02bcbb5
feat: routing (#32)
qkrdmstlr3 Aug 24, 2024
5acc554
feat(my-recruit): sticky 애니메이션 구현 (#33)
qkrdmstlr3 Aug 24, 2024
71e375e
feat(my-recruit): 로딩 스켈레톤 구현 (#34)
qkrdmstlr3 Aug 24, 2024
4b0ccd7
docs(readme) (#35)
qkrdmstlr3 Aug 24, 2024
8def9d9
feat(landing): 랜딩 페이지 구현중 (#36)
qkrdmstlr3 Aug 25, 2024
1d3b92a
style:Change DateDialog Style
eunbeann Aug 24, 2024
e176335
feat(my-recruit): 내 공고 뽀각 페이지 api 연결 (#28)
qkrdmstlr3 Aug 24, 2024
11ddcdd
style:Change DateDialog Style
eunbeann Aug 24, 2024
bb2847c
feat: fix the conflict
eunbeann Aug 25, 2024
dff129e
update: updateAPI
eunbeann Aug 25, 2024
5048afd
fix: fix console error
eunbeann Aug 25, 2024
b80db9e
fix: delete comment, duplicated component
eunbeann Aug 25, 2024
3487aaa
feat: add Icons
eunbeann Aug 26, 2024
1cd7efa
fix: fixing login
eunbeann Aug 26, 2024
8f3c799
fix: set The data type
eunbeann Aug 26, 2024
6d3cf85
fix: component update
eunbeann Aug 26, 2024
8bd9f19
feat(my-info): 내 정보 페이지 API 연동 (#29)
woo-jk Aug 24, 2024
a2d33e5
feat(my-recruit): 내 공고 뽀각 페이지 api 연결 (#28)
qkrdmstlr3 Aug 24, 2024
e77101f
style:Change DateDialog Style
eunbeann Aug 24, 2024
7745f42
apis: changedAPI
eunbeann Aug 24, 2024
cb2505f
add: add RefreshIcon
eunbeann Aug 24, 2024
e55bb85
feat: fix sth
eunbeann Aug 24, 2024
4de3786
feat(my-recruit): 내 공고 뽀각 페이지 api 연결 (#28)
qkrdmstlr3 Aug 24, 2024
847af0b
style:Change DateDialog Style
eunbeann Aug 24, 2024
f367bd5
feat(my-recruit): 내 공고 뽀각 페이지 api 연결 (#28)
qkrdmstlr3 Aug 24, 2024
29aacd9
Merge branch 'main' into feat/insideMyRecurit
eunbeann Aug 26, 2024
821663d
style:Change DateDialog Style
eunbeann Aug 24, 2024
7b604e9
feat: build Error fix
eunbeann Aug 26, 2024
837500d
restore: restore RefreshIcon
eunbeann Aug 26, 2024
84aa0f7
fix: build Errors
eunbeann Aug 26, 2024
587a56d
style: fix for none Title
eunbeann Aug 26, 2024
4ae2e4a
fix: delete useless things
eunbeann Aug 26, 2024
e726b2b
fix: delete wrong invalidate
eunbeann Aug 27, 2024
86fb9be
fix : fixing return
eunbeann Aug 27, 2024
5ff8afc
fix: delete Primitive type
eunbeann Aug 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
8 changes: 4 additions & 4 deletions src/apis/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { serverErrorType } from '@/types/api';
import { isProductionEnv } from '@/utils/common';
import type {
AxiosError,
Expand Down Expand Up @@ -48,10 +47,10 @@ axiosInstance.interceptors.response.use(

async (error: AxiosError) => {
if (axios.isAxiosError(error)) {
const data = error.response?.data as serverErrorType;
const status = error.response?.status;
const refreshToken = getCookie('refreshToken');
if (refreshToken) {
if (data?.status === 'UNAUTHORIZED') {
if (status === 401) {
if (refreshToken) {
deleteCookie('accessToken');
deleteCookie('refreshToken');
try {
Expand All @@ -62,6 +61,7 @@ axiosInstance.interceptors.response.use(
window.location.href = '/login';
}
}
window.location.href = '/login';
}
}

Expand Down
20 changes: 20 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/useDeleteRecruit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { http } from '@/apis/http';
import { useMutation, useQueryClient } from '@tanstack/react-query';

const deleteRecruit = (id: string) => {
return http.delete({
url: `/recruits/${id}`,
});
};

export const useDeleteRecruit = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: deleteRecruit,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['info-card-list'] });
queryClient.invalidateQueries({ queryKey: ['card-type-count'] });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recruit를 삭제하는데 info-card 관련 데이터들을 invalidate 하는 동작이 맞나요!?

},
});
};
20 changes: 20 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/useGetAllTag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { http } from '@/apis/http';
import { TagType } from '@/types';
import { useSuspenseQuery } from '@tanstack/react-query';

type Response = { data: TagType[] };

const getAllTags = () => {
return http.get<TagType[]>({
url: `/tags`,
});
};

export function useGetAllTags() {
const result = useSuspenseQuery({
queryKey: ['get-all-tags'],
queryFn: () => getAllTags(),
});

return result.data as unknown as Response;
}
21 changes: 21 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/useGetCardCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { http } from '@/apis/http';
import { useSuspenseQuery } from '@tanstack/react-query';

type getCardCountType = Record<'서류_준비' | '과제_준비' | '인터뷰_준비', number>;

type Response = { data: getCardCountType };

const getCardCount = (id: string) => {
return http.get<getCardCountType>({
url: `/recruits/${id}/cards/type-count`,
});
};

export function useGetCardCount(id: string) {
const result = useSuspenseQuery({
queryKey: ['get-progress-recruit'],
queryFn: () => getCardCount(id),
});

return result.data as unknown as Response;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입 단언이 없어도 될 것 같고, useSuspenseQuery에서 반환하는 result를 그대로 반환하는건 어떨까요?
사용하는 측에서 data 외에도 다른 값들이 필요할 수도 있을 것 같아서요!!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 이거 자세히 보니 useSuspenseQuery에서 반환하는 data가 아니라 http.get에서 반환하는 data군요??

그러면 queryFn에서 data를 한 번 걸러서 반환해주는건 어떤가요??

queryFn: async () => {
  const res = await getCardCount(id);
  return res.data;
}

}
33 changes: 33 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/useGetProgressRecruit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { http } from '@/apis/http';
import { useSuspenseQuery } from '@tanstack/react-query';

export interface NearestScheduleType {
id: number;
recruitScheduleStage: string;
deadLine: string;
}

export interface ProgressRecruitType {
id: number;
title: string;
season: string;
siteUrl: string;
recruitStatus: string;
createdDate: string;
nearestSchedule: NearestScheduleType | null;
}

const getProgressRecruit = () => {
return http.get<ProgressRecruitType[]>({
url: `/recruits/progressing`,
});
};

export function useGetProgressRecruit() {
const result = useSuspenseQuery({
queryKey: ['get-progress-recruit'],
queryFn: () => getProgressRecruit(),
});

return result.data as unknown as ProgressRecruitType[];
}
27 changes: 27 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/useGetRecruitById.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { http } from '@/apis/http';
import { useSuspenseQuery } from '@tanstack/react-query';

interface recruitByIdType {
id: number;
title: string;
season: string;
siteUrl: string;
recruitStatus: string;
}

type Response = { data: recruitByIdType };

const getRecruitById = (id: string) => {
return http.get<recruitByIdType>({
url: `/recruits/${id}`,
});
};

export function useGetRecruitById(id: string) {
const result = useSuspenseQuery({
queryKey: ['get-recruit-by-id', id],
queryFn: () => getRecruitById(id),
});

return result.data as unknown as Response;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 query 훅에서도 위 코멘트와 동일합니다!

}
27 changes: 27 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/useGetRecruitCards.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { http } from '@/apis/http';
import { TagType } from '@/types';
import { useSuspenseQuery } from '@tanstack/react-query';

export type GetRecruitCardsType = {
id: number;
title: string;
updatedDate: string;
tagList: TagType[];
};

type Response = { data: GetRecruitCardsType[] };

const getRecruitCards = ({ id, progress }: { id: string; progress: string }) => {
return http.get<GetRecruitCardsType[]>({
url: `recruits/${id}/cards?type=${progress}`,
});
};

export function useGetRecruitCards({ id, progress }: { id: string; progress: string }) {
const result = useSuspenseQuery({
queryKey: ['get-recruit-card-id', id, progress],
queryFn: () => getRecruitCards({ id, progress }),
});

return result.data as unknown as Response;
}
23 changes: 23 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/useGetSeason.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { http } from '@/apis/http';
import { useSuspenseQuery } from '@tanstack/react-query';

export interface SeasonType {
name: string;
}

type Response = { data: SeasonType[] };

const getSeasons = () => {
return http.get<SeasonType[]>({
url: `/seasons`,
});
};

export function useGetSeasons() {
const result = useSuspenseQuery({
queryKey: ['get-seasons'],
queryFn: () => getSeasons(),
});

return result.data as unknown as Response;
}
32 changes: 32 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/usePatchSeason.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { http } from '@/apis/http';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { ProgressRecruitType } from './useGetProgressRecruit';

interface patchSeasonProps {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앞글자 대문자로 맞추면 좋을 것 같아요~ PatchSeasonProps

newSeason: string;
id: string;
}

const patchSeason = ({ newSeason, id }: patchSeasonProps) => {
return http.patch<ProgressRecruitType>({
url: `/recruits/${id}/season`,
data: {
season: newSeason,
},
});
};

export const usePatchSeason = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: async ({ newSeason, id }: patchSeasonProps) => {
const res = await patchSeason({ newSeason, id });

return res.data;
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['get-recruit-by-id'] });
},
});
};
32 changes: 32 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/usePatchSiteUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { http } from '@/apis/http';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { ProgressRecruitType } from './useGetProgressRecruit';

interface patchSiteProps {
newSiteUrl: string;
id: string;
}

const patchSiteUrl = ({ newSiteUrl, id }: patchSiteProps) => {
return http.patch<ProgressRecruitType>({
url: `/recruits/${id}/siteUrl`,
data: {
siteUrl: newSiteUrl,
},
});
};

export const usePatchSiteUrl = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: async ({ newSiteUrl, id }: patchSiteProps) => {
const res = await patchSiteUrl({ newSiteUrl, id });

return res.data;
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['get-recruit-by-id'] });
},
});
};
37 changes: 37 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/usePatchStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { http } from '@/apis/http';
import { useMutation, useQueryClient } from '@tanstack/react-query';

interface PatchStatusResponse {
status: string;
}

interface patchStatusProps {
newStatus: string;
id: string;
}

const patchStatus = ({ newStatus, id }: patchStatusProps) => {
return http.patch<PatchStatusResponse>({
url: `/recruits/${id}/status`,
data: {
recruitStatus: newStatus,
},
});
};

export const usePatchStatus = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: async ({ newStatus, id }: patchStatusProps) => {
const res = await patchStatus({ newStatus, id });

console.log(res);

return res.data;
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['get-recruit-by-id'] });
},
});
};
35 changes: 35 additions & 0 deletions src/app/(sidebar)/my-recruit/[id]/api/usePatchTitle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { http } from '@/apis/http';
import { useMutation, useQueryClient } from '@tanstack/react-query';

interface PatchTitleResponse {
title: string;
}

interface patchTitleProps {
newTitle: string;
id: string;
}

const patchTitle = ({ newTitle, id }: patchTitleProps) => {
return http.patch<PatchTitleResponse>({
url: `/recruits/${id}/title`,
data: {
title: newTitle,
},
});
};

export const usePatchTitle = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: async ({ newTitle, id }: patchTitleProps) => {
const res = await patchTitle({ newTitle, id });

return res.data;
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['get-recruit-by-id'] });
},
});
};
Loading
Loading