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

feat: 개발 서버에서 로그인이 가능하게 기능 추가 #193

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions frontend/app/application/done/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ const ApplicationDonePage = ({
<div>
<Link
className="text-blue-500 hover:underline font-bold"
href={
"https://recruit.econovation.kr/applicant/pdf-viewer?id=" +
(id ?? "")
}
href={"/applicant/pdf-viewer?id=" + (id ?? "")}
>
여기
</Link>
Expand Down
10 changes: 7 additions & 3 deletions frontend/components/kanban/DragDrop.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ import { useAtom, useAtomValue } from "jotai";
import { KanbanSelectedButtonNumberState } from "@/src/stores/kanban/Navbar.atoms";
import useDragDrop from "@/src/hooks/useDragDrop.hook";

const KanbanColumnView = () => {
interface KanbanColumnViewProps {
generation: string;
}

const KanbanColumnView = ({ generation }: KanbanColumnViewProps) => {
const navbarId = useAtomValue(KanbanSelectedButtonNumberState);

const {
data: kanbanData,
isError,
isLoading,
} = useQuery<KanbanColumnData[]>(["kanbanDataArray", navbarId], () =>
getAllKanbanData(navbarId)
getAllKanbanData(navbarId, generation)
);

if (!kanbanData || isLoading) {
Expand Down Expand Up @@ -65,7 +69,7 @@ const KanbanBoardDragDropComponent = ({
ref={provided.innerRef}
{...provided.droppableProps}
>
<KanbanColumnView />
<KanbanColumnView generation={generation} />
<KanbanAddColumnComponent />
{provided.placeholder}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const KanbanColumnDetailCard = ({
isError,
isLoading,
} = useQuery<KanbanColumnData[]>(["kanbanDataArray", generation], () =>
getAllKanbanData(navbarId)
getAllKanbanData(navbarId, generation)
);

if (!kanbanDataArray || isLoading) {
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/apis/kanban/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export interface KanbanCardReq {
}

// TODO: card api 추가 시 수정 필요
export const getKanbanCards = async (columnId: string) => {
export const getKanbanCards = async (columnId: string, generation: string) => {
const { data } = await https.get<KanbanCardReq[]>(
`/navigations/${columnId}/boards`
`/navigations/${columnId}/boards?${new URLSearchParams({
year: generation,
})}`
);

return data;
Expand Down Expand Up @@ -90,10 +92,11 @@ export const postAddCard = async ({ columnId, title }: addCardReq) => {
};

export const getAllKanbanData = async (
navigationId: string
navigationId: string,
generation: string
): Promise<KanbanColumnData[]> => {
const columnsData = await getColums(navigationId);
const cardsData = await getKanbanCards(navigationId);
const cardsData = await getKanbanCards(navigationId, generation);

return columnsData.map((column) => {
const startColumnCardData = cardsData
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/apis/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const signIn = async ({ email, password }: SignInReq) => {
const { data } = await https.post<SignInRes>("/login", { email, password });
if (data satisfies SignInRes) {
alert("로그인이 성공하였습니다");
window.localStorage.setItem("accessToken", data.accessToken);
}

return true;
Expand All @@ -26,6 +27,7 @@ export const signIn = async ({ email, password }: SignInReq) => {
export const signOut = async () => {
try {
await https.post<SignInRes>("/logout");
window.localStorage.removeItem("accessToken");
return true;
} catch (e) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/functions/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const https = axios.create({
https.defaults.withCredentials = true;

https.interceptors.request.use((config) => {
const token = JSON.parse(localStorage.getItem("accessToken") ?? '""');
const token = localStorage.getItem("accessToken");
if (token) {
config.headers["Authorization"] = `Bearer ${token}`;
}
Expand Down