VLD-dev-team / Social-Co2

Social-CO2 est un projet universitaire d'application sociale permettant de comparer l'impact de ses activités quotidiennes sur l'environnement.
https://social-co2.vld-group.com
Other
1 stars 0 forks source link

Crash: Cannot access 'multiplier' before initialization #12

Closed Vrock691 closed 6 months ago

Vrock691 commented 6 months ago

L'API crash quand on cherche à mettre à jour les données d'un utilisateurs. Endpoint: POST /user

Node renvoie le code suivant :

/home/vldsite/Social-Co2/server/apiroutes/user.js:266
        if (typeof recycl !== 'boolean' || typeof nb_inhabitants !== 'number' || typeof area !== 'number' || typeof garden !== 'boolean' || typeof multiplier !== 'number' || typeof car !== 'number' || typeof hybrid !== 'boolean' || typeof heating !== 'string') {
                                                                                                                           ^

ReferenceError: Cannot access 'multiplier' before initialization
    at /home/vldsite/Social-Co2/server/apiroutes/user.js:266:124
    at Layer.handle [as handle_request] (/home/vldsite/Social-Co2/server/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/vldsite/Social-Co2/server/node_modules/express/lib/router/route.js:144:13)
    at next (/home/vldsite/Social-Co2/server/node_modules/express/lib/router/route.js:140:7)
    at next (/home/vldsite/Social-Co2/server/node_modules/express/lib/router/route.js:140:7)
    at next (/home/vldsite/Social-Co2/server/node_modules/express/lib/router/route.js:140:7)
    at Route.dispatch (/home/vldsite/Social-Co2/server/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/home/vldsite/Social-Co2/server/node_modules/express/lib/router/layer.js:95:5)
    at /home/vldsite/Social-Co2/server/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/home/vldsite/Social-Co2/server/node_modules/express/lib/router/index.js:346:12)

Node.js v18.19.0
Kez0X commented 6 months ago

Erreur réglé au niveau de la requête POST : définition de la constante avant utilisation avec par défaut 1