feat: zobrazení minulého týdne o víkendu místo "Užívejte víkend" (#30)
Na víkendu se nyní zobrazuje páteční menu s možností procházet celý týden. Editační ovládací prvky jsou automaticky skryté díky existující logice canChangeChoice.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import express from "express";
|
||||
import bodyParser from "body-parser";
|
||||
import cors from 'cors';
|
||||
import { getData, getDateForWeekIndex } from "./service";
|
||||
import { getData, getDateForWeekIndex, getToday } from "./service";
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
import { getQr } from "./qr";
|
||||
import { generateToken, verify } from "./auth";
|
||||
import { InsufficientPermissions } from "./utils";
|
||||
import { getIsWeekend, InsufficientPermissions } from "./utils";
|
||||
import { initWebsocket } from "./websocket";
|
||||
import pizzaDayRoutes from "./routes/pizzaDayRoutes";
|
||||
import foodRoutes, { refreshMetoda } from "./routes/foodRoutes";
|
||||
@@ -133,6 +133,9 @@ app.get("/api/data", async (req, res) => {
|
||||
if (!isNaN(index)) {
|
||||
date = getDateForWeekIndex(parseInt(req.query.dayIndex));
|
||||
}
|
||||
} else if (getIsWeekend(getToday())) {
|
||||
// Na víkendu zobrazíme pátek místo hlášky "Užívejte víkend"
|
||||
date = getDateForWeekIndex(4);
|
||||
}
|
||||
res.status(200).json(await getData(date));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user