Skip to content
Snippets Groups Projects
Commit edbb40e4 authored by Tim-Luca Taxis's avatar Tim-Luca Taxis
Browse files

fixed display error for status(409)

parent b3057910
No related branches found
No related tags found
1 merge request!7fixed display error for status(409)
......@@ -35,8 +35,10 @@ const AddFruit = () => {
});
if (response.status === 409) {
return console.error("Fruit already added");
const errorData = await response.json();
console.error("Fruit already added");
setError(errorData.error);
return ;
}
if (!response.ok) {
......
......@@ -18,7 +18,7 @@ export default async function handler(request, response) {
if (existingFruit.rows.length > 0) {
return response.status(409).json({error:'Fruit already added'})
return response.status(409).json({ error: 'Fruit already added '});
}
const result = await sql`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment