Oprava validace délky poznámky
This commit is contained in:
parent
93ba8def03
commit
731fd2eeb9
@ -214,10 +214,6 @@ function App() {
|
||||
|
||||
const saveNote = async (note?: string) => {
|
||||
if (auth?.login) {
|
||||
if (note != null && note.length > 70) {
|
||||
alert("Poznámka může mít maximálně 70 znaků");
|
||||
return;
|
||||
}
|
||||
await errorHandler(() => updateNote(note, dayIndex));
|
||||
setNoteModalOpen(false);
|
||||
}
|
||||
@ -373,8 +369,7 @@ function App() {
|
||||
<Alert variant={'primary'}>
|
||||
Poslední změny:
|
||||
<ul>
|
||||
<li>Anděloviny</li>
|
||||
<li>Zamezení posunů mezi dny šipkami v inputech</li>
|
||||
<li>Pokus o aktualizaci poznámky s příliš velkou délkou již neshazuje server</li>
|
||||
</ul>
|
||||
</Alert>
|
||||
{dayIndex != null &&
|
||||
|
@ -97,6 +97,7 @@ router.post("/updateNote", async (req, res, next) => {
|
||||
const login = getLogin(parseToken(req));
|
||||
const trusted = getTrusted(parseToken(req));
|
||||
const note = req.body.note;
|
||||
try {
|
||||
if (note && note.length > 70) {
|
||||
throw Error("Poznámka může mít maximálně 70 znaků");
|
||||
}
|
||||
@ -110,7 +111,6 @@ router.post("/updateNote", async (req, res, next) => {
|
||||
}
|
||||
date = getDateForWeekIndex(dayIndex);
|
||||
}
|
||||
try {
|
||||
const data = await updateNote(login, trusted, note, date);
|
||||
getWebsocket().emit("message", await addVolatileData(data));
|
||||
res.status(200).json(data);
|
||||
|
@ -85,14 +85,16 @@ router.post("/finishDelivery", async (req, res) => {
|
||||
res.status(200).json({});
|
||||
});
|
||||
|
||||
router.post("/updatePizzaDayNote", async (req, res) => {
|
||||
router.post("/updatePizzaDayNote", async (req, res, next) => {
|
||||
const login = getLogin(parseToken(req));
|
||||
try {
|
||||
if (req.body.note && req.body.note.length > 70) {
|
||||
throw Error("Poznámka může mít maximálně 70 znaků");
|
||||
}
|
||||
const data = await updatePizzaDayNote(login, req.body.note);
|
||||
getWebsocket().emit("message", await addVolatileData(data));
|
||||
res.status(200).json(data);
|
||||
} catch (e: any) { next(e) }
|
||||
});
|
||||
|
||||
router.post("/updatePizzaFee", async (req, res, next) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user