@movalib/movalib-commons 1.1.77 → 1.1.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,5 +3,5 @@ import { MovaAppType } from "../helpers/Enums";
3
3
  import User from "../models/User";
4
4
  export default class AuthenticationService {
5
5
  static forgotPassword(req: any): Promise<APIResponse<string>>;
6
- static login(appType: MovaAppType, email: string, password: string): Promise<APIResponse<User>>;
6
+ static login(appType: MovaAppType, phoneEmail: string, password: string): Promise<APIResponse<User>>;
7
7
  }
@@ -58,34 +58,40 @@ var AuthenticationService = /** @class */ (function () {
58
58
  });
59
59
  });
60
60
  };
61
- AuthenticationService.login = function (appType, email, password) {
61
+ AuthenticationService.login = function (appType, phoneEmail, password) {
62
62
  return __awaiter(this, void 0, void 0, function () {
63
- var url, tokenCookie, tokenResponse, userResponse, errorMsg, error_1, errorMessage;
63
+ var url, tokenCookie, req, tokenResponse, userResponse, errorMsg, error_1, errorMessage;
64
64
  return __generator(this, function (_a) {
65
65
  switch (_a.label) {
66
66
  case 0:
67
67
  _a.trys.push([0, 5, , 6]);
68
68
  url = '';
69
69
  tokenCookie = '';
70
+ req = void 0;
70
71
  Logger_1.default.info(ApiHelper_1.API_BASE_URL);
71
72
  switch (appType) {
72
73
  case Enums_1.MovaAppType.GARAGE:
73
74
  url = "".concat(ApiHelper_1.API_BASE_URL, "/garage/login");
74
75
  tokenCookie = CookieUtils_1.COOKIE_PRO_TOKEN;
76
+ req = {
77
+ email: phoneEmail,
78
+ password: password
79
+ };
75
80
  break;
76
81
  case Enums_1.MovaAppType.INDIVIDUAL:
77
82
  url = "".concat(ApiHelper_1.API_BASE_URL, "/login");
78
83
  tokenCookie = CookieUtils_1.COOKIE_INDIVIDUAL_TOKEN;
84
+ req = {
85
+ phoneEmail: phoneEmail,
86
+ password: password
87
+ };
79
88
  break;
80
89
  }
81
90
  return [4 /*yield*/, (0, ApiHelper_1.request)({
82
91
  url: url,
83
92
  method: Enums_1.APIMethod.POST,
84
93
  appType: appType,
85
- body: JSON.stringify({
86
- email: email,
87
- password: password
88
- })
94
+ body: JSON.stringify(req)
89
95
  })];
90
96
  case 1:
91
97
  tokenResponse = _a.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.1.77",
3
+ "version": "1.1.78",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,12 +15,13 @@ export default class AuthenticationService {
15
15
  });
16
16
  }
17
17
 
18
- static async login(appType: MovaAppType, email: string, password: string): Promise<APIResponse<User>> {
18
+ static async login(appType: MovaAppType, phoneEmail: string, password: string): Promise<APIResponse<User>> {
19
19
  try {
20
20
 
21
21
  // Contextualisation selon l'application demandeuse
22
22
  let url = '';
23
23
  let tokenCookie = '';
24
+ let req;
24
25
 
25
26
  Logger.info(API_BASE_URL);
26
27
 
@@ -28,10 +29,18 @@ export default class AuthenticationService {
28
29
  case MovaAppType.GARAGE:
29
30
  url = `${API_BASE_URL}/garage/login`;
30
31
  tokenCookie = COOKIE_PRO_TOKEN;
32
+ req = {
33
+ email : phoneEmail,
34
+ password: password
35
+ }
31
36
  break;
32
37
  case MovaAppType.INDIVIDUAL:
33
38
  url = `${API_BASE_URL}/login`;
34
39
  tokenCookie = COOKIE_INDIVIDUAL_TOKEN;
40
+ req = {
41
+ phoneEmail : phoneEmail,
42
+ password: password
43
+ }
35
44
  break;
36
45
  }
37
46
 
@@ -39,10 +48,7 @@ export default class AuthenticationService {
39
48
  url: url,
40
49
  method: APIMethod.POST,
41
50
  appType: appType,
42
- body: JSON.stringify({
43
- email : email,
44
- password: password
45
- })
51
+ body: JSON.stringify(req)
46
52
  });
47
53
 
48
54
  if(tokenResponse.success){