HyeonJun Jeon

[Del] Test code

...@@ -4,7 +4,6 @@ import { useNavigate } from "react-router-dom"; ...@@ -4,7 +4,6 @@ import { useNavigate } from "react-router-dom";
4 //import { login } from "../libs/E_Campus"; 4 //import { login } from "../libs/E_Campus";
5 5
6 import "../styles/Debug.css"; 6 import "../styles/Debug.css";
7 -import { initTempSubjects } from "../utils/Test";
8 7
9 const Debug = () => { 8 const Debug = () => {
10 console.log("visit Debug"); 9 console.log("visit Debug");
...@@ -26,10 +25,6 @@ const Debug = () => { ...@@ -26,10 +25,6 @@ const Debug = () => {
26 const handleSubmit = async (e) => { 25 const handleSubmit = async (e) => {
27 let result; 26 let result;
28 switch (state.type) { 27 switch (state.type) {
29 - case "initSubjects":
30 - await initTempSubjects();
31 - result = "inited";
32 - break;
33 case "login": 28 case "login":
34 //result = login(state.input1, state.input2); 29 //result = login(state.input1, state.input2);
35 break; 30 break;
...@@ -66,7 +61,6 @@ const Debug = () => { ...@@ -66,7 +61,6 @@ const Debug = () => {
66 <div> 61 <div>
67 <span>type : </span> 62 <span>type : </span>
68 <select name="type" value={state.type} onChange={handleChangeState}> 63 <select name="type" value={state.type} onChange={handleChangeState}>
69 - <option value={"initSubjects"}>initSubjects</option>
70 <option value={"login"}>login</option> 64 <option value={"login"}>login</option>
71 <option value={"server"}>server</option> 65 <option value={"server"}>server</option>
72 </select> 66 </select>
......
1 -import { subForage, scheForage, dataForage } from "./LocalForage";
2 -import { toYMDStr } from "./Dates";
3 -
4 -async function initTempSubjects() {
5 - const tempsch = [
6 - {
7 - subCode: "1",
8 - type: "zoom",
9 - category: "과목A",
10 - label: "",
11 - start: [9, 30],
12 - },
13 - {
14 - subCode: "2",
15 - type: "ecampus",
16 - category: "과목B",
17 - label: "과제",
18 - end: [23, 59],
19 - },
20 - ];
21 -
22 - await scheForage.setItem(toYMDStr(new Date("2022-5-20"), "/"), tempsch);
23 - await scheForage.setItem(toYMDStr(new Date("2022-5-27"), "/"), tempsch);
24 - await scheForage.setItem(toYMDStr(new Date("2022-6-3"), "/"), tempsch);
25 -
26 - let tcolors = [
27 - "red",
28 - "green",
29 - "blue",
30 - "orange",
31 - "gold",
32 - "aqua",
33 - "chartreuse",
34 - ];
35 - const subCodeLst = ["1", "2"];
36 - const subObj = {
37 - 1: {
38 - name: "과목A",
39 - color: tcolors[0],
40 - selected: true,
41 - },
42 - 2: {
43 - name: "과목B",
44 - color: tcolors[1],
45 - selected: true,
46 - },
47 - };
48 -
49 - await subForage.setItem("1", subObj["1"]);
50 - await subForage.setItem("2", subObj["2"]);
51 -
52 - for (let i = 2; i < 7; i++) {
53 - let code = (i + 1).toString();
54 - let tsub = {
55 - name: "과목" + code,
56 - color: tcolors[i],
57 - selected: true,
58 - };
59 - subCodeLst.push(code);
60 - await subForage.setItem(code, tsub);
61 - }
62 - dataForage.setItem("Subjects", subCodeLst);
63 -}
64 -
65 -export { initTempSubjects };