Skip to content

Commit

Permalink
enhancement/RECODE01#4/setting
Browse files Browse the repository at this point in the history
  • Loading branch information
sejung1997 committed Jun 19, 2022
1 parent df57a59 commit 4c2e2aa
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 18 deletions.
17 changes: 0 additions & 17 deletions src/api/getSearchData.js

This file was deleted.

14 changes: 14 additions & 0 deletions src/component/challenge/api/getChallengeData.js
Original file line number Diff line number Diff line change
@@ -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("요청에 실패함");
};
32 changes: 31 additions & 1 deletion src/pages/challenge/list/index.js
Original file line number Diff line number Diff line change
@@ -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 = `
<h1>내 첼린지</h1>
<ul>
</ul
`
}
render()
}

0 comments on commit 4c2e2aa

Please sign in to comment.