Variable d'environnement pour l'URL du serveur API

This commit is contained in:
Emmy D'Anello 2024-12-10 08:43:25 +01:00
parent 4da75e310e
commit 72862da3a6
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
3 changed files with 7 additions and 2 deletions

View File

@ -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

1
client/.env.development Normal file
View File

@ -0,0 +1 @@
EXPO_PUBLIC_TRAINTRAPE_MOI_SERVER=http://localhost:3000/

View File

@ -23,7 +23,7 @@ export default function Login() {
if (loggingIn) if (loggingIn)
return return
setLoggingIn(true) 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", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name: name, password: password }) body: JSON.stringify({ name: name, password: password })