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

Merge branch 'master' into 'main'

fixed display error for status(409)

See merge request !7
parents 67c0c77b edbb40e4
No related branches found
No related tags found
1 merge request!7fixed display error for status(409)
...@@ -35,8 +35,10 @@ const AddFruit = () => { ...@@ -35,8 +35,10 @@ const AddFruit = () => {
}); });
if (response.status === 409) { if (response.status === 409) {
const errorData = await response.json();
return console.error("Fruit already added"); console.error("Fruit already added");
setError(errorData.error);
return ;
} }
if (!response.ok) { if (!response.ok) {
......
...@@ -18,7 +18,7 @@ export default async function handler(request, response) { ...@@ -18,7 +18,7 @@ export default async function handler(request, response) {
if (existingFruit.rows.length > 0) { 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` 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