From 72862da3a6e9d58669efafb06a0aeca49fab2f2b Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Tue, 10 Dec 2024 08:43:25 +0100 Subject: [PATCH] Variable d'environnement pour l'URL du serveur API --- client/.env | 6 +++++- client/.env.development | 1 + client/app/login.tsx | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 client/.env.development diff --git a/client/.env b/client/.env index e92d907..fe53af4 100644 --- a/client/.env +++ b/client/.env @@ -1 +1,5 @@ -ANDROID_HOME=/opt/android-sdk +# Public variables +EXPO_PUBLIC_TRAINTRAPE_MOI_SERVER=https://traintrapemoi.luemy.eu/api + +# Build variables +ANDROID_HOME=/opt/android-sdk \ No newline at end of file diff --git a/client/.env.development b/client/.env.development new file mode 100644 index 0000000..2b13beb --- /dev/null +++ b/client/.env.development @@ -0,0 +1 @@ +EXPO_PUBLIC_TRAINTRAPE_MOI_SERVER=http://localhost:3000/ diff --git a/client/app/login.tsx b/client/app/login.tsx index 4721655..63859a8 100644 --- a/client/app/login.tsx +++ b/client/app/login.tsx @@ -23,7 +23,7 @@ export default function Login() { if (loggingIn) return setLoggingIn(true) - const resp = await fetch("http://192.168.1.198:3000/auth/login/", { + const resp = await fetch(`${process.env.EXPO_PUBLIC_TRAINTRAPE_MOI_SERVER}/auth/login/`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: name, password: password })