Skip to content

Commit

Permalink
fix: PR Conflict 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
KimKyuHoi committed Jun 3, 2024
1 parent 46ffd3b commit 4ab89a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/apis/auth/refresh.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export async function refresh(): Promise<AuthAPIRequest> {
}
}

export async function refreshWorkSpace(): Promise<AuthAPIRequest> {
export async function refreshWorkSpace(
workspaceId: number
): Promise<AuthAPIRequest> {
try {
const workspaceId = localStorage.getItem('selectedWorkSpaceId');
const parsedWorkspaceId = workspaceId ? parseInt(workspaceId, 10) : null;
const response = await axios.post(
`${BASE_URI}/users/reissue-workspace`,
{ workspaceId: parsedWorkspaceId },
{ workspaceId },
{
withCredentials: true,
}
Expand Down
8 changes: 5 additions & 3 deletions src/components/common/sider/WorkSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {

import { WorkSpaceMenuItem } from '@finnect/interface/SlideMenuInterface';

import { refreshWorkSpace } from '@finnect/apis/auth/refresh.api';
import { useGetWorkSpaceQuery } from '@finnect/hooks/queries/workspace/useGetWorkSpaceQuery';
import { usePostWorkSpaceQuery } from '@finnect/hooks/queries/workspace/usePostWorkSpaceQuery';
import { useRefreshQuery } from '@finnect/hooks/queries/auth/useRefreshQuery';

const WorkSpace = () => {
const { data, isPending, isError, error, refetch } = useGetWorkSpaceQuery();
Expand All @@ -35,6 +35,7 @@ const WorkSpace = () => {
useRecoilState<boolean>(modalVisibleState);
const [newItemTitle, setNewItemTitle] =
useRecoilState<string>(newItemTitleState);
const { mutate: refreshData } = useRefreshQuery();

useEffect(() => {
if (data) {
Expand All @@ -56,9 +57,10 @@ const WorkSpace = () => {
(item: WorkSpaceMenuItem) => {
set(selectedWorkSpaceState, item.title);
set(selectedWorkSpaceIdState, item.key);
refreshWorkSpace();
refreshData(parseInt(item.key));

localStorage.setItem('selectedWorkSpace', item.title);
localStorage.setItem('selectedWorkSpaceId', item.key.toString());
localStorage.setItem('selectedWorkSpaceId', item.key);
}
);

Expand Down
4 changes: 2 additions & 2 deletions src/mocks/handler/people/PeopleHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IPeopleProps } from '@finnect/interface/PeopleInterface';
import { IMemberProps } from '@finnect/interface/MemberInterface';
import { http, HttpResponse } from 'msw';

export const PeopleHandler = [
Expand All @@ -23,7 +23,7 @@ export const PeopleHandler = [
}),

http.post('/workspaces/members', async ({ request }) => {
const { nickname, role, phone } = (await request.json()) as IPeopleProps;
const { nickname, role, phone } = (await request.json()) as IMemberProps;

if (!nickname || !role || !phone) {
return HttpResponse.json(
Expand Down

0 comments on commit 4ab89a4

Please sign in to comment.