Skip to content

Commit

Permalink
refactor: baseUrl 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
wo-o29 committed Sep 29, 2024
1 parent 30f2dd9 commit d85e75f
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 11 deletions.
5 changes: 5 additions & 0 deletions public/icons/arrow-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/apis/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import axios, { AxiosError, AxiosInstance } from "axios";
import { ReissueAccessToken } from "./api";

export const instance = axios.create({
baseURL: "http://localhost:8080",
// baseURL: "http://localhost:8080",
baseURL: process.env.NEXT_PUBLIC_SERVER_BASE_URL,
});

export const setInstance = (baseUrl: string): AxiosInstance => {
Expand Down
25 changes: 25 additions & 0 deletions src/components/Button/BackButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Image from "next/image";
import { useRouter } from "next/router";

import * as S from "./styled";

function BackButton() {
const router = useRouter();

const handleRouteBack = () => {
router.back();
};

return (
<S.BackButton type="button" onClick={handleRouteBack}>
<Image
width={28}
height={28}
src="/icons/arrow-left.svg"
alt="좌측 방향 화살표"
/>
</S.BackButton>
);
}

export default BackButton;
23 changes: 23 additions & 0 deletions src/components/Button/BackButton/styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import styled from "@emotion/styled";

export const BackButton = styled.button`
display: flex;
align-items: center;
padding-top: 0.22rem;
&:hover {
animation: move-left 1s ease infinite;
}
@keyframes move-left {
0% {
transform: translateX(0);
}
50% {
transform: translateX(-5px);
}
100% {
transform: translateX(0);
}
}
`;
6 changes: 3 additions & 3 deletions src/components/Modal/Login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Image from "next/image";

import React from "react";

import { oauth2Type } from "@/types";
Expand Down Expand Up @@ -36,6 +34,8 @@ const LOGIN_PLATFORM: LoginPlatformType[] = [
},
];

const BASE_URL = process.env.NEXT_PUBLIC_SERVER_BASE_URL;

function LoginModal({
isOpen,
onClose,
Expand Down Expand Up @@ -64,7 +64,7 @@ function LoginModal({
{LOGIN_PLATFORM.map((platform) => (
<S.SocialNavLink
key={platform.id}
href={`http://localhost:8080/oauth2/authorization/${platform.name}`}
href={`${BASE_URL}/oauth2/authorization/${platform.name}`}
>
<S.SocialLogo
src={platform.icon}
Expand Down
1 change: 1 addition & 0 deletions src/pages/api/clearCookies.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const handler = (req: NextApiRequest, res: NextApiResponse) => {
`accessToken=; Path=/; HttpOnly;, SameSite=Strict; Max-Age=0; Secure`,
`refreshToken=; Path=/; HttpOnly;, SameSite=Strict; Max-Age=0; Secure`,
]);

res.status(200).json({ message: "로그아웃이 성공적으로 처리되었습니다" });
} catch (error) {
res
Expand Down
6 changes: 5 additions & 1 deletion src/pages/mypage/bookmark/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ReactElement, Suspense } from "react";

import BackButton from "@/components/Button/BackButton";
import FestivalGrid from "@/components/Festival/Grid";
import HeaderLayout from "@/components/Layout/HeaderLayout";

Expand All @@ -9,7 +10,10 @@ import SkeletonGrid from "../components/Bookmark/Skeleton/Grid";
function BookmarkPage() {
return (
<S.Container>
<S.Title>즐겨찾기 한 축제 목록</S.Title>
<S.Box>
<BackButton />
<S.Title>즐겨찾기 한 축제 목록</S.Title>
</S.Box>
<Suspense fallback={<SkeletonGrid count={8} />}>
<FestivalGrid />
</Suspense>
Expand Down
11 changes: 8 additions & 3 deletions src/pages/mypage/bookmark/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ export const Container = styled.main`
}
`;

export const Box = styled.div`
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0 0 1rem 0.25rem;
border-bottom: 2px solid #000;
`;

export const Title = styled.h2`
font-size: 1.5625rem;
font-weight: 700;
padding-bottom: 1rem;
border-bottom: 2px solid #000;
margin-bottom: 2rem;
`;
6 changes: 5 additions & 1 deletion src/pages/mypage/review/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { ReactElement, Suspense } from "react";

import BackButton from "@/components/Button/BackButton";
import HeaderLayout from "@/components/Layout/HeaderLayout";
import ReviewList from "@/components/ReviewList";

Expand All @@ -9,7 +10,10 @@ import ReviewSkeleton from "../components/Review/Skeleton";
function ReviewPage() {
return (
<S.Container>
<S.Title>작성한 후기 목록</S.Title>
<S.Box>
<BackButton />
<S.Title>작성한 후기 목록</S.Title>
</S.Box>
<Suspense fallback={<ReviewSkeleton count={10} />}>
<ReviewList />
</Suspense>
Expand Down
10 changes: 8 additions & 2 deletions src/pages/mypage/review/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ export const Container = styled.main`
}
`;

export const Box = styled.div`
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0 0 1rem 0.25rem;
border-bottom: 2px solid #000;
`;

export const Title = styled.h2`
font-size: 1.5625rem;
font-weight: 700;
padding-bottom: 1rem;
border-bottom: 2px solid #000;
`;

0 comments on commit d85e75f

Please sign in to comment.