meet-my-ride 1.0.4 → 1.0.5

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.
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { UserLogin, UserLoginResponse, UserRegister, User, UserUpdate, UserRefreshResponse } from "./user.types";
2
+ import { UserLogin, UserRegister, User, UserUpdate, UserRefreshResponse, AuthResponse, UserRegisterResponse, VerifyEmailResponse } from "./user.types";
3
3
  export declare class UserService {
4
4
  private http;
5
5
  private updateToken;
@@ -13,11 +13,11 @@ export declare class UserService {
13
13
  /** DELETE /api/Users/{userId} */
14
14
  delete(userId: string): Promise<void>;
15
15
  /** POST /api/Users/register */
16
- register(data: UserRegister): Promise<UserLoginResponse>;
16
+ register(data: UserRegister): Promise<UserRegisterResponse>;
17
17
  /** POST /api/Users/login */
18
- login(data: UserLogin): Promise<UserLoginResponse>;
18
+ login(data: UserLogin): Promise<AuthResponse>;
19
19
  /** POST /api/Users/refresh */
20
20
  refresh(refreshToken: string): Promise<UserRefreshResponse>;
21
21
  /** POST /api/Users/verify-email */
22
- verifyEmail(code: string): Promise<void>;
22
+ verifyEmail(userId: string, token: string): Promise<VerifyEmailResponse>;
23
23
  }
@@ -34,8 +34,9 @@ class UserService {
34
34
  async login(data) {
35
35
  const response = await this.http.post("/api/Users/login", data);
36
36
  const resData = response.data;
37
- if (resData.token) {
38
- this.updateToken(resData.token);
37
+ // Only update token if it exists
38
+ if (resData.accessToken) {
39
+ this.updateToken(resData.accessToken);
39
40
  }
40
41
  return resData;
41
42
  }
@@ -45,14 +46,18 @@ class UserService {
45
46
  refreshToken
46
47
  });
47
48
  const resData = response.data;
48
- if (resData.token) {
49
- this.updateToken(resData.token);
49
+ if (resData.accessToken) {
50
+ this.updateToken(resData.accessToken);
50
51
  }
51
52
  return resData;
52
53
  }
53
54
  /** POST /api/Users/verify-email */
54
- async verifyEmail(code) {
55
- await this.http.post("/api/Users/verify-email", { code });
55
+ async verifyEmail(userId, token) {
56
+ const response = await this.http.post("/api/Users/verifyEmail", {
57
+ userId,
58
+ token
59
+ });
60
+ return response.data;
56
61
  }
57
62
  }
58
63
  exports.UserService = UserService;
@@ -1,33 +1,47 @@
1
1
  export interface User {
2
2
  id: string;
3
3
  email: string;
4
+ emailVerified?: string;
4
5
  firstName: string;
5
6
  lastName: string;
7
+ username: string;
6
8
  }
7
9
  export interface UserLogin {
8
10
  email: string;
9
11
  password: string;
10
12
  }
11
- export interface UserLoginResponse {
12
- token: string;
13
+ export interface AuthResponse {
14
+ user: User;
15
+ accessToken?: string;
13
16
  refreshToken?: string;
14
- userId?: string;
15
- expiresIn?: number;
16
17
  }
17
18
  export interface UserRegister {
18
19
  email: string;
19
20
  password: string;
20
21
  firstName: string;
21
22
  lastName: string;
23
+ username: string;
24
+ }
25
+ export interface UserRegisterResponse {
26
+ id: string;
27
+ username: string;
28
+ firstName: string;
29
+ lastName: string;
30
+ email: string;
22
31
  }
23
32
  export interface UserUpdate {
24
33
  email?: string;
25
34
  firstName?: string;
26
35
  lastName?: string;
27
36
  password?: string;
37
+ username?: string;
28
38
  }
29
39
  export interface UserRefreshResponse {
30
- token: string;
40
+ accessToken: string;
31
41
  refreshToken?: string;
32
42
  expiresIn?: number;
33
43
  }
44
+ export interface VerifyEmailResponse {
45
+ message: string;
46
+ isVerified: boolean;
47
+ }
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
+ // user.types.ts
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meet-my-ride",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Private library for the MeetMyRide applications",
5
5
  "repository": {
6
6
  "type": "git",