tering-serieuze-sdk 3.5.1 → 3.6.0
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.
- package/package.json +1 -1
- package/src/api/auth.ts +6 -3
- package/src/index.ts +9 -3
package/package.json
CHANGED
package/src/api/auth.ts
CHANGED
|
@@ -19,7 +19,7 @@ export class AuthModule extends BaseModule {
|
|
|
19
19
|
|
|
20
20
|
async setCode(code: string) {
|
|
21
21
|
// TODO any ?!
|
|
22
|
-
const { accessToken } = await this.api.post<any>(`auth/setCode?code=${code}`, {});
|
|
22
|
+
const { accessToken } = await this.api.post<any>(`auth/setCode?code=${code}`, {}, { credentials: "include" });
|
|
23
23
|
return accessToken;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -38,11 +38,14 @@ export class AuthModule extends BaseModule {
|
|
|
38
38
|
async verifyRegistration(registrationToken: string, registrationResponse: RegistrationResponseJSON) {
|
|
39
39
|
return this.api.post<VerificationResponseDto>(
|
|
40
40
|
`auth/verify-registration/${registrationToken}`,
|
|
41
|
-
registrationResponse
|
|
41
|
+
registrationResponse,
|
|
42
|
+
{ credentials: "include" }
|
|
42
43
|
);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
async verifyAuthentication(token: string, response: AuthenticationResponseJSON) {
|
|
46
|
-
return this.api.post<VerificationResponseDto>(`auth/verify-authentication/${token}`, response
|
|
47
|
+
return this.api.post<VerificationResponseDto>(`auth/verify-authentication/${token}`, response, {
|
|
48
|
+
credentials: "include",
|
|
49
|
+
});
|
|
47
50
|
}
|
|
48
51
|
}
|
package/src/index.ts
CHANGED
|
@@ -77,9 +77,15 @@ export class TssApi {
|
|
|
77
77
|
return response;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
protected async fetchPossibleEmptyResponse<T>(
|
|
80
|
+
protected async fetchPossibleEmptyResponse<T>(
|
|
81
|
+
method: HttpMethod,
|
|
82
|
+
url: string,
|
|
83
|
+
dto: Dto,
|
|
84
|
+
config: SDKRequestInit = {}
|
|
85
|
+
) {
|
|
81
86
|
return this.fetch(url, {
|
|
82
87
|
method,
|
|
88
|
+
...config,
|
|
83
89
|
body: JSON.stringify(dto),
|
|
84
90
|
});
|
|
85
91
|
}
|
|
@@ -89,8 +95,8 @@ export class TssApi {
|
|
|
89
95
|
return response.json() as Promise<T>;
|
|
90
96
|
}
|
|
91
97
|
|
|
92
|
-
async post<T>(url: string, dto: Dto) {
|
|
93
|
-
const response = await this.fetchPossibleEmptyResponse<T>("POST", url, dto);
|
|
98
|
+
async post<T>(url: string, dto: Dto, config: SDKRequestInit = {}) {
|
|
99
|
+
const response = await this.fetchPossibleEmptyResponse<T>("POST", url, dto, config);
|
|
94
100
|
if (response === undefined) {
|
|
95
101
|
throw new Error("Response was undefined");
|
|
96
102
|
}
|