Skip to content

Commit

Permalink
Merge pull request #60 from team-crews/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
Goonco authored Nov 9, 2024
2 parents 1f80af6 + a0114d9 commit d8882bf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
6 changes: 2 additions & 4 deletions src/apis/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ const useAuthInstance = () => {
useEffect(() => {
const requestIntercept = authInstance.interceptors.request.use(
(config) => {
console.log();
if (!config.headers?.Authorization)
config.headers.Authorization = accessToken;

return config;
},
(e) => {
Expand All @@ -44,14 +42,14 @@ const useAuthInstance = () => {
async (error) => {
const prevRequest = error?.config;

if (error?.response?.status === 403 && !prevRequest?.sent) {
if (error?.response?.status === 401 && !prevRequest?.sent) {
prevRequest.sent = true; // Prevent Infinite Loop

prevRequest.headers['Authorization'] = await refresh();
return authInstance(prevRequest);
}

if (error?.response?.status === 403) clearSession();
if (error?.response?.status === 401) clearSession();
return Promise.reject(error);
},
);
Expand Down
12 changes: 7 additions & 5 deletions src/app/recruit/_components/recruit-complete/footer-section.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Button } from '../../../../components/shadcn/button.tsx';
import CrewsDialog from '../../../../components/molecule/crews-dialog.tsx';
import { useQueryClient } from '@tanstack/react-query';
import { useToast } from '../../../../hooks/use-toast.ts';
Expand All @@ -15,6 +14,7 @@ import {
TooltipTrigger,
} from '../../../../components/shadcn/tooltip.tsx';
import useAtomicMutation from '../../../../hooks/use-atomic-mutation.ts';
import { Button } from '../../../../components/shadcn/button.tsx';

const url = import.meta.env.VITE_KAKAO_OPEN_CHAT;

Expand Down Expand Up @@ -91,10 +91,12 @@ const FooterSection = ({
) : null}
<CrewsFooter>
<Tooltip>
<TooltipTrigger>
<Button size="lg" disabled>
CSV 추출
</Button>
<TooltipTrigger asChild>
<div>
<Button size="lg" disabled>
CSV 추출
</Button>
</div>
</TooltipTrigger>

<TooltipContent>
Expand Down
2 changes: 1 addition & 1 deletion src/app/sign-up/_components/admin-sign-up.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const AdminSignUp = () => {
return (
<>
<a
href={import.meta.env.VITE_KAKAO_ADMIN_CHAT}
href={import.meta.env.VITE_NEW_RECRUITER}
target="_blank"
className="flex w-full items-center justify-center gap-2 rounded bg-[#2F3234] py-2 text-sm font-bold tracking-widest text-crews-w01 hover:bg-crews-bk02"
>
Expand Down
3 changes: 3 additions & 0 deletions src/components/wrapper/try-login-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Loading from '../atom/loading.tsx';
import useRefreshToken from '../../hooks/use-refresh-token.ts';
import { printCustomError } from '../../lib/utils/error.ts';
import { Outlet } from 'react-router-dom';
import useSession from '../../hooks/use-session.ts';

/*
ToDo
Expand All @@ -12,12 +13,14 @@ import { Outlet } from 'react-router-dom';
const TryLoginWrapper = () => {
const [loading, setLoading] = useState(true);
const { refresh } = useRefreshToken();
const { clearSession } = useSession();

useEffect(() => {
const redirectByAuth = async () => {
try {
await refresh();
} catch (e) {
clearSession();
printCustomError(e, 'redirectByAuth');
} finally {
setLoading(false);
Expand Down
1 change: 0 additions & 1 deletion src/lib/utils/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export function throwCustomError(e: unknown, errorFunctionName: string): never {
// FixMe
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function getErrorMessage(error: any): string {
console.log(error);
if (isRouteErrorResponse(error)) {
if (error.status === 404) return '페이지를 찾을 수 없습니다';
}
Expand Down

0 comments on commit d8882bf

Please sign in to comment.