diff --git a/src/api/getSearchData.js b/src/api/getSearchData.js deleted file mode 100644 index 499a477..0000000 --- a/src/api/getSearchData.js +++ /dev/null @@ -1,17 +0,0 @@ -const baseUrl = - "https://wr4a6p937i.execute-api.ap-northeast-2.amazonaws.com/dev"; - -// const cache = {}; -export const getSearchData = async (keywords) => { - // if (cache[keywords]) { - // console.log("zzzz"); - // return cache[keywords]; - // } - const res = await fetch(`${baseUrl}/languages?keyword=${keywords}`); - if (res.ok) { - const json = await res.json(); - // cache[keywords] = json; - return json; - } - throw new Error("요청에 실패함"); -}; diff --git a/src/component/challenge/api/getChallengeData.js b/src/component/challenge/api/getChallengeData.js new file mode 100644 index 0000000..1b16baf --- /dev/null +++ b/src/component/challenge/api/getChallengeData.js @@ -0,0 +1,14 @@ +const baseUrl = + "https://backend.ddudutodo.site/api/v1/challenges"; + +// const cache = {}; +export const getData = async (keywords) => { + + const res = await fetch(`${baseUrl}/`); + if (res.ok) { + const json = await res.json(); + // cache[keywords] = json; + return json; + } + throw new Error("요청에 실패함"); +}; diff --git a/src/pages/challenge/list/index.js b/src/pages/challenge/list/index.js index 267e227..5a11e4e 100644 --- a/src/pages/challenge/list/index.js +++ b/src/pages/challenge/list/index.js @@ -1 +1,31 @@ -export default function CallengeListPage() {} +import {getData} from "../../../../src/component/challenge/api/getChallengeData" +export default function ChallengeList () { + const target = document.querySelector(".App") + const element = document.createElement("div") + let state = + [ + { + "name": "string", + "contents": "string", + "image": "string", + "start_date": "2022-06-19T09:19:42.168000+00:00", + "end_date": "2022-06-19T09:19:42.168000+00:00", + "tags": [ + "string" + ], + "id": 1 + } + ] + state = await getData(0) + + const render = () => { + element.innerHTML = ` +

내 첼린지

+