forked from codesquad-members-2022/sidedish
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 2baf578.
- Loading branch information
Showing
42 changed files
with
226 additions
and
1,175 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
# misc | ||
.DS_Store | ||
|
||
|
||
.env | ||
|
||
.env.local | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,41 @@ | ||
import React from "react"; | ||
import Main from "pages/Main"; | ||
import Header from "components/Header"; | ||
import React, { useCallback, useEffect, useState } from "react"; | ||
import axios from "axios"; | ||
import BestMealContainer from "components/BestMealContainer"; | ||
import MealContainer from "components/MealContainer"; | ||
import { MOCK_SERVER_URL } from "constant"; | ||
|
||
const App = () => { | ||
function App() { | ||
const [meals, setMeals] = useState({ | ||
mealHeader: "", | ||
mealCards: [], | ||
}); | ||
const fetchCategoryMeal = useCallback(async () => { | ||
try { | ||
const { status, data } = await axios.get(`${MOCK_SERVER_URL}/api/products?meal=main`); | ||
// TODO: status 코드 300번 구간도 포함해야하나 공부해보기 | ||
if (status >= 400) { | ||
throw Error(`${status}: 데이터를 받아오는 도중 에러 발생`); | ||
} | ||
console.log(data); | ||
setMeals({ | ||
mealHeader: "식탁을 풍성하게 하는 정갈한 밑반찬", | ||
mealCards: data, | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}, []); | ||
|
||
useEffect(() => { | ||
fetchCategoryMeal(); | ||
}, []); | ||
return ( | ||
<> | ||
<Header /> | ||
<Main /> | ||
<BestMealContainer /> | ||
<MealContainer meals={meals} /> | ||
<div className="Modal"></div> | ||
</> | ||
); | ||
}; | ||
} | ||
|
||
export default App; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.