Skip to content

Commit

Permalink
Merge pull request #7 from sejung1997/enhancement/#4/setting
Browse files Browse the repository at this point in the history
enhancement/#4/setting
  • Loading branch information
sejung1997 authored Jun 26, 2022
2 parents 109495e + 611e946 commit d110480
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 19 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<html lang="ko">
<head>
<meta charset="UTF-8" />
<title>2022 FE 데브매칭</title>
<title>뚜두투두</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<main class="App"></main>
Expand Down
17 changes: 0 additions & 17 deletions src/api/getSearchData.js

This file was deleted.

121 changes: 121 additions & 0 deletions src/component/challenge/api/getChallengeData.js
Original file line number Diff line number Diff line change
@@ -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: "[email protected]",
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: "[email protected]",
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: "[email protected]",
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: "[email protected]",
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: "[email protected]",
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: "[email protected]",
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("요청에 실패함");
};
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ export const routes = [
if (path === "/") router.push("/main");
else router.push(path);
};
})();
})();
34 changes: 34 additions & 0 deletions src/pages/challenge/list/index.js
Original file line number Diff line number Diff line change
@@ -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 = `
<h1>내 첼린지</h1>
<ul>
${state.map(
(el) => `
<li class="challengeList">
<div>${el.name}</div>
<di>마스터: ${el.master.name}<div>
<img src=${el.image}>
<div class="tags">
${el.tags.map(
(tagEl) => `
<div>${tagEl}</div>
`
)}
<div>${el.price}원~</div>
</div>
</li>
`
)}
</ul>
`;
};
const init = () => {
const el = document.createElement("div");
el.innerHTML = `<p>첼린지 리스트 페이지다잇</p>`;
Expand Down

0 comments on commit d110480

Please sign in to comment.