-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: hotdrinkvote 서버에서 fetch 하도록 변경
- Loading branch information
Showing
18 changed files
with
123 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
apps/jurumarble/src/app/main/components/HotDrinkContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
apps/jurumarble/src/app/main/components/HotDrinkVoteContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
apps/jurumarble/src/app/main/components/SearchInputWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
apps/jurumarble/src/app/main/components/TodayDrinkRecommendation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
apps/jurumarble/src/app/main/containers/HydratedDrinkVoteContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { dehydrate } from "@tanstack/query-core"; | ||
import { getHotDrinkVote } from "lib/apis/vote/getHotDrinkVote"; | ||
import getQueryClient from "src/modules/getQueryClient"; | ||
import HydrateOnClient from "src/modules/hydrateOnClient"; | ||
import HotDrinkVoteContainer from "../components/HotDrinkVoteContainer"; | ||
import { hotDrinkVoteQueryKey } from "../services/queryKey"; | ||
|
||
export const HydratedDrinkVoteContainer = async () => { | ||
const qc = getQueryClient(); | ||
await qc.prefetchQuery([hotDrinkVoteQueryKey], getHotDrinkVote); | ||
const dehydratedState = dehydrate(qc); | ||
return ( | ||
<HydrateOnClient state={dehydratedState}> | ||
<HotDrinkVoteContainer /> | ||
</HydrateOnClient> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const hotDrinkVoteQueryKey = "hotDrinkVote"; |
16 changes: 8 additions & 8 deletions
16
apps/jurumarble/src/app/main/services/useGetHotDrinkVoteService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { getHotDrinkVote } from "lib/apis/vote"; | ||
import { queryKeys } from "lib/queryKeys"; | ||
|
||
const getQueryKey = () => [queryKeys.HOT_DRINK_VOTE]; | ||
|
||
export default function useGetHotDrinkVoteService() { | ||
const { data: hotDrinkVote } = useQuery(getQueryKey(), getHotDrinkVote); | ||
import { getHotDrinkVote } from "lib/apis/vote/getHotDrinkVote"; | ||
import { hotDrinkVoteQueryKey } from "./queryKey"; | ||
|
||
export const useGetHotDrinkVoteService = () => { | ||
const { data: hotDrinkVote } = useQuery({ | ||
queryKey: [hotDrinkVoteQueryKey], | ||
queryFn: getHotDrinkVote, | ||
}); | ||
return { hotDrinkVote }; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.main-top-section { | ||
padding: 0 20px; | ||
} | ||
|
||
.main-bottom-section { | ||
padding: 0 20px 96px; | ||
margin-top: 8px; | ||
overflow: auto; | ||
} | ||
|
||
.main-divide-line { | ||
height: 8px; | ||
margin: 40px 0 8px 0; | ||
background-color: var(--bg_01); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { SERVER_URL } from "lib/env"; | ||
|
||
interface GetHotDrinkVoteResponse { | ||
voteId: number; | ||
voteTitle: string; | ||
drinkAImage: string; | ||
drinkBImage: string; | ||
} | ||
|
||
export const getHotDrinkVote = async () => { | ||
const res = await fetch(`${SERVER_URL}api/votes/drinks/hot`); | ||
const data = await res.json(); | ||
return data as GetHotDrinkVoteResponse; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Path from "./Path"; | ||
|
||
export const CLIENT_URL = process.env.NEXT_PUBLIC_CLIENT_URL || ""; | ||
export const SERVER_URL = process.env.NEXT_PUBLIC_SERVER_URL || ""; | ||
|
||
export const KAKAO_CLIENT_ID = process.env.NEXT_PUBLIC_KAKAO_CLIENT_ID || ""; | ||
export const NAVER_CLIENT_ID = process.env.NEXT_PUBLIC_NAVER_CLIENT_ID || ""; | ||
|
||
export const KAKAO_MAP_API_KEY = process.env.NEXT_PUBLIC_KAKAO_MAP_API_KEY || ""; | ||
export const KAKAO_LOGIN_REDIRECT_URL = | ||
process.env.NODE_ENV === "development" | ||
? `http://localhost:3000/${Path.KAKAO_LOGIN_PROCESS}` | ||
: `${CLIENT_URL}${Path.KAKAO_LOGIN_PROCESS}`; | ||
export const NAVER_LOGIN_REDIRECT_URL = | ||
process.env.NODE_ENV === "development" | ||
? `http://localhost:3000${Path.NAVER_LOGIN_PROCESS}` | ||
: `${CLIENT_URL}${Path.NAVER_LOGIN_PROCESS}`; | ||
|
||
export const DATA_GO_API_KEY = process.env.NEXT_PUBLIC_DATA_GO_API_KEY || ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { QueryClient } from "@tanstack/query-core"; | ||
import { cache } from "react"; | ||
|
||
const getQueryClient = cache(() => new QueryClient()); | ||
export default getQueryClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"use client"; | ||
|
||
import { Hydrate as HydrateOnClient } from "@tanstack/react-query"; | ||
export default HydrateOnClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters