Skip to content

Commit

Permalink
Merge pull request #178 from SCBJ-7/feature/#177-main
Browse files Browse the repository at this point in the history
[#177] 메인페이지에 0 뜨는 버그 수정
  • Loading branch information
Bumang-Cyber authored Jan 24, 2024
2 parents 4fb3ac6 + ca979b3 commit 110061b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
11 changes: 7 additions & 4 deletions src/apis/fetchMainItems.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { LocaleItemsType, WeekendItem } from "./../types/saleSection";
import { axiosInstance } from "@apis/axiosInstance";
import { END_POINTS } from "@/constants/api";
import { BASE_URL, END_POINTS } from "@/constants/api";
import axios from "axios";

// 유저 정보를 불러오는 api입니다.
export const fetchMainItem = async (): Promise<
[LocaleItemsType, WeekendItem[]]
> => {
const { data } = await axiosInstance.get(
END_POINTS.MAIN +
const { data } = await axios.get(
BASE_URL +
END_POINTS.MAIN +
"?cityNames=서울&cityNames=강원&cityNames=부산&cityNames=제주&cityNames=경상&cityNames=전라",
);

const { weekend, ...locale } = data.data;
const temp = weekend.content;
console.log([locale, temp], "locale, temp");

return [locale, temp];
};
8 changes: 4 additions & 4 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import ReactDOM from "react-dom/client";
import { RouterProvider } from "react-router-dom";
import { ThemeProvider } from "styled-components";
import { worker } from "./mocks/broswer";
// import { worker } from "./mocks/broswer";
import { router } from "./routes/router";
import { GlobalStyle } from "./styles/globalStyle";
import { theme } from "./styles/theme";

const queryClient = new QueryClient();
if (process.env.NODE_ENV === "development") {
worker.start();
}
// if (process.env.NODE_ENV === "development") {
// worker.start();
// }

ReactDOM.createRoot(document.getElementById("root")!).render(
<QueryClientProvider client={queryClient}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/homePage/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Home = () => {
const localeEntries: [number, string, LocaleItem[]][] = Object.entries(
localeProds,
)
.filter((v) => v[1] !== null)
.filter((v) => v[1].length !== 0)
.map((v, i) => [i, v[0], v[1]]);

const [localeAndHotel] = useState(localeEntries);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/homePage/percentAnimator/PercentAnimator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const PercentAnimator = ({
<S.Container>
{localeAndHotel.map(
(item) =>
item[2].length && (
item[2].length !== 0 && (
<AnimatePresence key={item[2][0]?.id}>
{item[2][0]?.salePercentage === percent && (
<S.PercentDiv animate={{ y: [30, 0] }} exit={{ y: [0, -30] }}>
Expand Down
2 changes: 0 additions & 2 deletions src/pages/transferWritingPricePage/TransferWritingPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const TransferWritingPrice = () => {
if (!is2ndChecked) return false; // 2차 가격 설정하기 체크 안 한 경우

if (is2ndChecked && secondPrice && downTimeAfter) {
console.log(firstPrice, opt1, opt2, opt3, optFinal, "???");
return true; // 2차 가격 설정한 경우
} else if (is2ndChecked && !secondPrice && !downTimeAfter) {
return false; // 2차 가격 체크했지만 아무것도 쓰지 않은 경우는 일단 가능
Expand All @@ -76,7 +75,6 @@ const TransferWritingPrice = () => {
} else if (is2ndChecked && secondPrice && !downTimeAfter) {
return false; // 2차 가격 체크하고 2차 시간 입력 안 하고 가격만 입력한 경우
} else if (!userData?.bank || !userData?.accountNumber) {
console.log("???");
return false;
}
}
Expand Down

0 comments on commit 110061b

Please sign in to comment.