Finish implementation of Hazard list so it can handle when hazards end
This commit is contained in:
parent
ab0b915249
commit
92822e2ddc
3 changed files with 21 additions and 11 deletions
|
|
@ -307,17 +307,17 @@ if (!process.env?.STATIC) {
|
|||
|
||||
app.post('/api/hazard-history', async (req, res) => {
|
||||
try {
|
||||
const { location, hazards } = req.body;
|
||||
const { location, locationKey, hazards } = req.body;
|
||||
|
||||
if (!location || !Array.isArray(hazards)) {
|
||||
if (!location || !locationKey || !Array.isArray(hazards)) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: 'Missing or invalid location/hazards',
|
||||
error: 'Missing or invalid location/locationKey/hazards',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const history = await updateHistory({ location, hazards });
|
||||
const history = await updateHistory({ location, locationKey, hazards });
|
||||
res.json({
|
||||
success: true,
|
||||
history,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue