From f9efea288fa5c965aec03763fe05d8230322bafa Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Wed, 1 Jul 2020 23:38:08 +0200 Subject: [PATCH] Removed unused function --- src/managers/ConnectionManager.js | 36 +++++++------------------------ 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/src/managers/ConnectionManager.js b/src/managers/ConnectionManager.js index 2ad0c33..b6d24fa 100644 --- a/src/managers/ConnectionManager.js +++ b/src/managers/ConnectionManager.js @@ -1,7 +1,7 @@ // @flow import * as Keychain from 'react-native-keychain'; -import {apiRequest, ERROR_TYPE, isResponseValid} from "../utils/WebData"; +import {apiRequest, ERROR_TYPE} from "../utils/WebData"; /** * champ: error @@ -138,38 +138,18 @@ export default class ConnectionManager { }; apiRequest(AUTH_PATH, 'POST', data) .then((response) => { - if (this.isConnectionResponseValid(response)) { - this.saveLogin(email, response.token) - .then(() => { - resolve(true); - }) - .catch(() => { - reject(ERROR_TYPE.TOKEN_SAVE); - }); - } else - reject(ERROR_TYPE.SERVER_ERROR); + this.saveLogin(email, response.token) + .then(() => { + resolve(true); + }) + .catch(() => { + reject(ERROR_TYPE.TOKEN_SAVE); + }); }) .catch((error) => reject(error)); }); } - /** - * Checks if the API connection response is correctly formatted - * - * @param response - * @returns {boolean} - */ - isConnectionResponseValid(response: { [key: string]: any }) { - let valid = isResponseValid(response); - - if (valid && response.error === ERROR_TYPE.SUCCESS) - valid = valid - && response.data.token !== undefined - && response.data.token !== '' - && typeof response.data.token === "string"; - return valid; - } - /** * Sends an authenticated request with the login token to the API *