Implemented login/logout
This commit is contained in:
@@ -35,6 +35,10 @@ export default new class {
|
||||
return !!localStorage.getItem(LOCAL_STORAGE_KEY)
|
||||
}
|
||||
|
||||
clearTokenFromLocalStorage() {
|
||||
localStorage.removeItem(LOCAL_STORAGE_KEY);
|
||||
}
|
||||
|
||||
_performApiCall(method, url, data, precheckToken, expectedStatus, errorTexts = COMMON_ERROR_CODES) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -86,7 +90,7 @@ export default new class {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
this._performApiCall('post', '/auth/login', {name, password}, false, 201, {
|
||||
this._performApiCall('post', '/auth/login', {name, password}, false, 200, {
|
||||
401: "Invalid credentials",
|
||||
...COMMON_ERROR_CODES
|
||||
}).then((data) => {
|
||||
|
||||
Reference in New Issue
Block a user