Browse Source

Removed unused function

Arnaud Vergnet 1 year ago
parent
commit
f9efea288f
1 changed files with 8 additions and 28 deletions
  1. 8
    28
      src/managers/ConnectionManager.js

+ 8
- 28
src/managers/ConnectionManager.js View File

@@ -1,7 +1,7 @@
1 1
 // @flow
2 2
 
3 3
 import * as Keychain from 'react-native-keychain';
4
-import {apiRequest, ERROR_TYPE, isResponseValid} from "../utils/WebData";
4
+import {apiRequest, ERROR_TYPE} from "../utils/WebData";
5 5
 
6 6
 /**
7 7
  * champ: error
@@ -138,39 +138,19 @@ export default class ConnectionManager {
138 138
             };
139 139
             apiRequest(AUTH_PATH, 'POST', data)
140 140
                 .then((response) => {
141
-                    if (this.isConnectionResponseValid(response)) {
142
-                        this.saveLogin(email, response.token)
143
-                            .then(() => {
144
-                                resolve(true);
145
-                            })
146
-                            .catch(() => {
147
-                                reject(ERROR_TYPE.TOKEN_SAVE);
148
-                            });
149
-                    } else
150
-                        reject(ERROR_TYPE.SERVER_ERROR);
141
+                    this.saveLogin(email, response.token)
142
+                        .then(() => {
143
+                            resolve(true);
144
+                        })
145
+                        .catch(() => {
146
+                            reject(ERROR_TYPE.TOKEN_SAVE);
147
+                        });
151 148
                 })
152 149
                 .catch((error) => reject(error));
153 150
         });
154 151
     }
155 152
 
156 153
     /**
157
-     * Checks if the API connection response is correctly formatted
158
-     *
159
-     * @param response
160
-     * @returns {boolean}
161
-     */
162
-    isConnectionResponseValid(response: { [key: string]: any }) {
163
-        let valid = isResponseValid(response);
164
-
165
-        if (valid && response.error === ERROR_TYPE.SUCCESS)
166
-            valid = valid
167
-                && response.data.token !== undefined
168
-                && response.data.token !== ''
169
-                && typeof response.data.token === "string";
170
-        return valid;
171
-    }
172
-
173
-    /**
174 154
      * Sends an authenticated request with the login token to the API
175 155
      *
176 156
      * @param path

Loading…
Cancel
Save