diff --git a/src/pages/index.astro b/src/pages/index.astro index 6c0600e..14e35ca 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -7,7 +7,7 @@ if (Astro.request.method === "POST") { const data = await Astro.request.formData(); const name = data.get("name"); const email = data.get("email"); - fetch('https://catapult.purplebubble.org/api/subscribe', { + const response = await fetch('https://catapult.purplebubble.org/api/subscribe', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -17,15 +17,13 @@ if (Astro.request.method === "POST") { const jsondata = await response.json(); if (jsondata.ok = true){ //do nothing - }else{ + } else{ error = jsondata.error; } } catch (error) { if (error instanceof Error) { - error && ( -
Error: {error}
- ) + console.log(error) } } } @@ -53,6 +51,9 @@ if (Astro.request.method === "POST") {Error: {error}
+ )}