@dev-crew-berlin/enter-js-utils 0.42.0 → 0.43.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.
|
@@ -20,9 +20,13 @@ export declare type RequestBody<Path extends keyof paths, Method extends HTTPMet
|
|
|
20
20
|
export default class APIBase {
|
|
21
21
|
private credentials;
|
|
22
22
|
private isLoggedIn;
|
|
23
|
+
private clientBucket;
|
|
24
|
+
private deviceName;
|
|
23
25
|
private onLogout;
|
|
24
26
|
constructor(args: {
|
|
25
27
|
credentials: APICredentials;
|
|
28
|
+
clientBucket: string;
|
|
29
|
+
deviceName: string;
|
|
26
30
|
onLogout: (reason?: string) => void;
|
|
27
31
|
});
|
|
28
32
|
private static fetchResult;
|
|
@@ -3,6 +3,8 @@ export default class APIBase {
|
|
|
3
3
|
constructor(args) {
|
|
4
4
|
this.credentials = args.credentials;
|
|
5
5
|
this.onLogout = args.onLogout;
|
|
6
|
+
this.clientBucket = args.clientBucket;
|
|
7
|
+
this.deviceName = args.deviceName;
|
|
6
8
|
this.isLoggedIn = true;
|
|
7
9
|
}
|
|
8
10
|
static async fetchResult(input, init) {
|
|
@@ -17,7 +19,9 @@ export default class APIBase {
|
|
|
17
19
|
const body = data !== null ? JSON.stringify(data) : null;
|
|
18
20
|
const headers = {
|
|
19
21
|
Authorization: `bearer ${this.credentials.accessToken}`,
|
|
20
|
-
'Content-Type': 'application/json'
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
'X-Enter-Device-Name': this.deviceName,
|
|
24
|
+
'X-Enter-Client-Bucket': this.clientBucket
|
|
21
25
|
};
|
|
22
26
|
const res = await APIBase.fetchResult(`${this.credentials.url}${endpoint}`, {
|
|
23
27
|
method: method.toUpperCase(),
|