refactoring

This commit is contained in:
xinatorus 2020-05-12 19:25:08 +02:00
parent 6458e89dea
commit 3981d9551d
2 changed files with 40 additions and 40 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
class AuthApi { class AuthApi {
public function login(){ public function login(){
$token = (new ApiManager)->getToken($this->input->username,$this->input->password); $token = (new AuthManager)->getToken($this->input->username,$this->input->password);
if (!$token) { if (!$token) {
throw new Exception("Auth failed", 401); throw new Exception("Auth failed", 401);
} }
@ -10,7 +10,7 @@ class AuthApi {
public function logout(){ public function logout(){
$authenticationBearrer = $_SERVER['HTTP_AUTHORIZATION']; $authenticationBearrer = $_SERVER['HTTP_AUTHORIZATION'];
if (!(new ApiManager)->deleteToken($authenticationBearrer)) { if (!(new AuthManager)->deleteToken($authenticationBearrer)) {
throw new Exception("logout Failed", 401); throw new Exception("logout Failed", 401);
} }
} }