Skip to content

Commit e2b1aa0

Browse files
authored
[chore] env환경변수설정 (#86)
* [style]mybar * [style]알람설정 * [style] 탭 메뉴 접근성 * [style]마이페이지 * [style]마이페이지 반응형 수정 * [style]툴팁컴포넌트 * [chore]포매팅 * [style] 마이페이지 mybar 카드 정렬 수정 * [chore]환경변수설정 * [chore]auth getAPI사용 * [chore]환경변수 재설정
1 parent f4f2879 commit e2b1aa0

File tree

6 files changed

+47
-14
lines changed

6 files changed

+47
-14
lines changed

next.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ const nextConfig: NextConfig = {
44

55
// webpack 설정
66
webpack: (config) => {
7+
8+
env: {
9+
NPUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL;
10+
}
11+
712
// @ts-expect-error 타입 에러 무시
813
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'));
914

src/app/api/config/appConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const getApi =
2+
process.env.NODE_ENV === 'development'
3+
? process.env.NEXT_PUBLIC_API_URL_DEV
4+
: process.env.NEXT_PUBLIC_API_URL_PROD;

src/app/mypage/my-setting/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function MySetting() {
2424
<ToggleBtn />
2525
</div>
2626
</div>
27-
<div className="p-4 bg-gray w-20 flex-center items-center">ToopTip</div>
2827
<div className="flex justify-between items-center">
2928
<TextButton onClick={() => setIsQuit(!isQuit)}>회원탈퇴</TextButton>
3029

src/app/mypage/mybar/page.tsx

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,44 @@ import Img from '@/shared/assets/images/dummy/exampleCocktail.png';
55
function MyBar() {
66
return (
77
<div
8-
className="grid grid-cols-2 mt-10 gap-8 w-full sm:[grid-template-columns:repeat(2,minmax(0,320px))] md:justify-evenly md:[grid-template-columns:repeat(3,minmax(0,250px))]
9-
lg:[grid-template-columns:repeat(4,minmax(0,250px))]"
8+
className="grid grid-cols-1 justify-items-center mt-10 gap-8 sm:[grid-template-columns:repeat(2,minmax(0,320px))] sm:justify-evenly md:[grid-template-columns:repeat(3,minmax(0,250px))]
9+
"
1010
>
11-
<CocktailCard src={Img} type="myBar" name="Old Pashioned" nameKo="올드 패션드"></CocktailCard>
1211
<CocktailCard
1312
src={Img}
14-
type="myBar"
13+
textSize1="text-xl"
1514
name="Old Pashioned"
1615
nameKo="올드 패션드"
17-
></CocktailCard>{' '}
18-
<CocktailCard src={Img} type="myBar" name="Old Pashioned" nameKo="올드 패션드"></CocktailCard>{' '}
19-
<CocktailCard src={Img} type="myBar" name="Old Pashioned" nameKo="올드 패션드"></CocktailCard>{' '}
20-
<CocktailCard src={Img} type="myBar" name="Old Pashioned" nameKo="올드 패션드"></CocktailCard>{' '}
21-
<CocktailCard src={Img} type="myBar" name="Old Pashioned" nameKo="올드 패션드"></CocktailCard>
16+
keep={false}
17+
></CocktailCard>
18+
<CocktailCard
19+
src={Img}
20+
textSize1="text-xl"
21+
name="Old Pashioned"
22+
nameKo="올드 패션드"
23+
keep={false}
24+
></CocktailCard>
25+
<CocktailCard
26+
src={Img}
27+
textSize1="text-xl"
28+
name="Old Pashioned"
29+
nameKo="올드 패션드"
30+
keep={false}
31+
></CocktailCard>
32+
<CocktailCard
33+
src={Img}
34+
textSize1="text-xl"
35+
name="Old Pashioned"
36+
nameKo="올드 패션드"
37+
keep={false}
38+
></CocktailCard>
39+
<CocktailCard
40+
src={Img}
41+
textSize1="text-xl"
42+
name="Old Pashioned"
43+
nameKo="올드 패션드"
44+
keep={false}
45+
></CocktailCard>
2246
</div>
2347
);
2448
}

src/domains/recipe/CocktailCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function CocktailCard({ src, name, nameKo, keep = true, className, textSize1, te
2727
{/* <Image src={src} alt={name} fill /> */}
2828
<Image src={Img} alt="" fill className="object-cover " />
2929
{keep && (
30-
<div className="flex w-full px-2 items-center justify-between absolute left-0 top-0">
30+
<div className="flex w-full pl-4 px-3 py-2 items-center justify-between absolute left-0 top-0">
3131
<div>
3232
<Label title="레시피" />
3333
</div>

src/domains/shared/store/auth.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { getApi } from '@/app/api/config/appConfig';
12
import { create } from 'zustand';
23
import { persist } from 'zustand/middleware';
34

@@ -29,7 +30,7 @@ export const useAuthStore = create<AuthState>()(
2930
isLoggedIn: false,
3031

3132
loginWithProvider: (provider) => {
32-
window.location.href = `http://localhost:8080/oauth2/authorization/${provider}`;
33+
window.location.href = `${getApi}/oauth2/authorization/${provider}`;
3334
},
3435

3536
setUser: (user, token) => {
@@ -39,7 +40,7 @@ export const useAuthStore = create<AuthState>()(
3940

4041
logout: async () => {
4142
try {
42-
await fetch('http://localhost:8080/user/auth/logout', {
43+
await fetch(`${getApi}/user/auth/logout`, {
4344
method: 'POST',
4445
credentials: 'include',
4546
});
@@ -51,7 +52,7 @@ export const useAuthStore = create<AuthState>()(
5152

5253
updateUser: async () => {
5354
try {
54-
const res = await fetch('http://localhost:8080/user/auth/refresh', {
55+
const res = await fetch(`${getApi}/user/auth/refresh`, {
5556
method: 'POST',
5657
credentials: 'include',
5758
headers: { 'Content-Type': 'application/json' },

0 commit comments

Comments
 (0)