diff --git a/index.html b/index.html index 230dafc..5a4a633 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,8 @@ - 2022 FE 데브매칭 + 뚜두투두 +
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..22451cb --- /dev/null +++ b/src/component/challenge/api/getChallengeData.js @@ -0,0 +1,121 @@ +const baseUrl = "https://backend.ddudutodo.site/api/v1/challenges"; + +const cache = [ + { + name: "자전거로 출근", + contents: "string", + image: "string", + start_date: "2022-06-24T08:01:31.122Z", + end_date: "2022-06-24T08:01:31.122Z", + tags: ["깃생살기", "습관 만들기", "운동", "성별무관"], + master: { + email: "user@example.com", + name: "abc", + nick_name: "def", + picture: "string", + id: 0, + complete_rate: 0, + }, + id: 0, + user_cnt: 15, + }, + { + name: "자전거로 출근", + contents: "string", + image: "string", + start_date: "2022-06-24T08:01:31.122Z", + end_date: "2022-06-24T08:01:31.122Z", + tags: ["깃생살기", "습관 만들기", "운동", "성별무관"], + master: { + email: "user@example.com", + name: "abc", + nick_name: "def", + picture: "string", + id: 0, + complete_rate: 0, + }, + id: 0, + user_cnt: 15, + }, + { + name: "자전거로 출근", + contents: "string", + image: "string", + start_date: "2022-06-24T08:01:31.122Z", + end_date: "2022-06-24T08:01:31.122Z", + tags: ["깃생살기", "습관 만들기", "운동", "성별무관"], + master: { + email: "user@example.com", + name: "abc", + nick_name: "def", + picture: "string", + id: 0, + complete_rate: 0, + }, + id: 0, + user_cnt: 15, + }, + { + name: "자전거로 출근", + contents: "string", + image: "string", + start_date: "2022-06-24T08:01:31.122Z", + end_date: "2022-06-24T08:01:31.122Z", + tags: ["깃생살기", "습관 만들기", "운동", "성별무관"], + master: { + email: "user@example.com", + name: "abc", + nick_name: "def", + picture: "string", + id: 0, + complete_rate: 0, + }, + id: 0, + user_cnt: 15, + }, + { + name: "자전거로 출근", + contents: "string", + image: "string", + start_date: "2022-06-24T08:01:31.122Z", + end_date: "2022-06-24T08:01:31.122Z", + tags: ["깃생살기", "습관 만들기", "운동", "성별무관"], + master: { + email: "user@example.com", + name: "abc", + nick_name: "def", + picture: "string", + id: 0, + complete_rate: 0, + }, + id: 0, + user_cnt: 15, + }, + { + name: "자전거로 출근", + contents: "string", + image: "string", + start_date: "2022-06-24T08:01:31.122Z", + end_date: "2022-06-24T08:01:31.122Z", + tags: ["깃생살기", "습관 만들기", "운동", "성별무관"], + master: { + email: "user@example.com", + name: "abc", + nick_name: "def", + picture: "string", + id: 0, + complete_rate: 0, + }, + id: 0, + user_cnt: 15, + }, +]; +export const getData = async () => { + if (cache) return cache; + // const res = await fetch(`${baseUrl}/`); + // if (res.ok) { + // const json = await res.json(); + // return json; + // } + throw new Error("요청에 실패함"); +}; diff --git a/src/index.js b/src/index.js index 4b05cc0..2c9b530 100644 --- a/src/index.js +++ b/src/index.js @@ -60,4 +60,4 @@ export const routes = [ if (path === "/") router.push("/main"); else router.push(path); }; -})(); +})(); \ No newline at end of file diff --git a/src/pages/challenge/list/index.js b/src/pages/challenge/list/index.js index cea69aa..0d79f78 100644 --- a/src/pages/challenge/list/index.js +++ b/src/pages/challenge/list/index.js @@ -1,4 +1,38 @@ +import { getData } from "../../../../src/component/challenge/api/getChallengeData.js"; export default function ChallengeListPage({ root }) { + const element = document.createElement("div"); + $target?.appendChild(element); + let state = []; + (async function getList() { + state = await getData(0); + render(); + })(); + + const render = () => { + element.innerHTML = ` +

내 첼린지

+ + + `; + }; const init = () => { const el = document.createElement("div"); el.innerHTML = `

첼린지 리스트 페이지다잇

`;