diff --git a/components/Timetable.tsx b/components/Timetable.tsx index a2ea762..1db3379 100644 --- a/components/Timetable.tsx +++ b/components/Timetable.tsx @@ -115,7 +115,7 @@ const Timetable = ({ tds.length = 0; const table = target.children[0]; - table.setAttribute("border", "1"); + table.setAttribute("border", "0"); // mark cell const conflictsTmp: ConflictsTmp = {}; @@ -266,6 +266,7 @@ const Timetable = ({ <>

Login as {user}

= config.limit) { res.status(403).json({ - error: `超过选择数量限制: ${config.limit}`, + error: `超过选择数量限制,您至多选 ${config.limit} 个班.`, }); return; } } } - // check whether it is alreadly occupied + // check whether it is already occupied if (store[json.name] !== undefined) { res.status(403).json({ error: `当前位置已被他人占用`, @@ -46,8 +47,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) { delete store[json.name]; } } - console.log("query", req.query); - const resp = { + const resp: { occupied: string[], myselect: string[] } = { // try to fix occupied: [], myselect: [], }; diff --git a/pages/index.tsx b/pages/index.tsx index 05bbd9d..7d9c67c 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -9,9 +9,9 @@ export default function Home() { return ( <> - Create Next App - - + 抢 班 + + {/* */}
diff --git a/store/index.ts b/store/index.ts index 2cb0427..1dddcb3 100644 --- a/store/index.ts +++ b/store/index.ts @@ -30,7 +30,13 @@ class Store { await this.save(); } public async save() { - await write(this.filename, JSON.stringify(this.record), "utf8"); + // try first, then catch + try { + console.log("store::index: save record", this.record); + await write(this.filename, JSON.stringify(this.record), "utf8"); + } catch { + console.error("store::index: save record error, filename:", this.filename); + } } } @@ -52,7 +58,12 @@ class HTML { public async set(html: string) { this.html = html; // store into file - await write(this.filename, html, "utf8"); + // try first, then catch + try { + await write(this.filename, html, "utf8"); + } catch { + console.error("store::index: save record error, filename:", this.filename); + } } }