From 9a281ed76cb954c2a5afe0503ba3cabd940a1f60 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Tue, 6 Aug 2024 23:17:37 +0200 Subject: [PATCH] Update backend URLs to use environment variables Replaced hardcoded backend URLs with environment variables in contact, apply, and verify_email components. Added .env.development and .env.production files to define the base URLs for different environments. This improves flexibility and allows easier configuration changes. --- .env.development | 1 + .env.production | 1 + src/components/form/data/apply.tsx | 2 +- src/components/form/data/contact.tsx | 2 +- src/components/verify_email/verify_mail.tsx | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .env.development create mode 100644 .env.production diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..807fa82 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +REACT_APP_BACKEND_BASE_URL=http://localhost:8002 \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..d5f1baa --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +REACT_APP_BACKEND_BASE_URL=https://forms-backend.alttd.com \ No newline at end of file diff --git a/src/components/form/data/apply.tsx b/src/components/form/data/apply.tsx index b7215c4..bd26845 100644 --- a/src/components/form/data/apply.tsx +++ b/src/components/form/data/apply.tsx @@ -124,7 +124,7 @@ export const apply: FormData = { required: false, }, ], - backend: 'https://forms-backend.alttd.com/api/apply/staffApplication', + backend: `${process.env.REACT_APP_BACKEND_BASE_URL}/api/apply/staffApplication`, userInput: {username: '', email: '', discord: '', pc_requirements: '' , age: '', pronoun: '', join_date: '', avg_time: '', available_days: '', available_time: '', staff_experience: '' , plugin_experience: '', why_staff: '', expectations_mod: '', other: '' diff --git a/src/components/form/data/contact.tsx b/src/components/form/data/contact.tsx index b5b3f4b..2553b6f 100644 --- a/src/components/form/data/contact.tsx +++ b/src/components/form/data/contact.tsx @@ -28,7 +28,7 @@ export const contact: FormData = { required: true, }, ], - backend: 'https://forms-backend.alttd.com/api/contact/submitContactForm', + backend: `${process.env.REACT_APP_BACKEND_BASE_URL}/api/contact/submitContactForm`, userInput: {username: '', email: '', question: ''}, spec: Yup.object().shape({ username: Yup.string() diff --git a/src/components/verify_email/verify_mail.tsx b/src/components/verify_email/verify_mail.tsx index ceb327a..4cbc33f 100644 --- a/src/components/verify_email/verify_mail.tsx +++ b/src/components/verify_email/verify_mail.tsx @@ -42,7 +42,7 @@ const VerifyMail: FC = () => { eMail: email } console.log(verificationData); - fetch('https://forms-backend.alttd.com/api/verify_email/form', { + fetch(`${process.env.REACT_APP_BACKEND_BASE_URL}/api/verify_email/form`, { method: 'POST', headers: { 'Content-Type': 'application/json',