Change call of API
continuous-integration/drone/push Build is passing Details

master
dorian.hodin 2 years ago
parent 1cbba7e249
commit c2ea2c84a9

@ -97,24 +97,24 @@ $app->get('/getAllUsers', function(Request $request, Response $response){
return $response->withHeader('Content-type', 'application/json')->withStatus(200); return $response->withHeader('Content-type', 'application/json')->withStatus(200);
}); });
$app->get('/getUserPassword/:login', function(Request $request, Response $response, String $login){ $app->get('/getUserPassword/{login}', function(Request $request, Response $response, array $args){
if (empty($login)){ if (empty($args['login'])){
throw new TypeErrorParameters($request); throw new TypeErrorParameters($request);
} }
try{ try{
$response->getBody()->write(json_encode((new GatewayUser)->getUserPassword($login), JSON_UNESCAPED_UNICODE)); $response->getBody()->write(json_encode((new GatewayUser)->getUserPassword($args['login']), JSON_UNESCAPED_UNICODE));
}catch (PDOException $e){ }catch (PDOException $e){
throw new PDOError($request,$e->getMessage(),$e); throw new PDOError($request,$e->getMessage(),$e);
} }
return $response->withHeader('Content-type', 'application/json')->withStatus(200); return $response->withHeader('Content-type', 'application/json')->withStatus(200);
}); });
$app->post('/addUser/:login/:password', function(Request $request, Response $response, String $login, String $password){ $app->post('/addUser/{login}/{password}', function(Request $request, Response $response, array $args){
if (empty($login) || empty($password)){ if (empty($args['login']) || empty($args['password'])){
throw new TypeErrorParameters($request); throw new TypeErrorParameters($request);
} }
try{ try{
(new GatewayUser)->addUser($login,$password); (new GatewayUser)->addUser($args['login'],$args['password']);
}catch (PDOException $e){ }catch (PDOException $e){
throw new PDOError($request,$e->getMessage(),$e); throw new PDOError($request,$e->getMessage(),$e);
} }

Loading…
Cancel
Save