@lenne.tech/ng-base 0.3.10 → 0.3.11
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/bundles/lenne.tech-ng-base-src-lib-base.umd.js +15 -22
- package/bundles/lenne.tech-ng-base-src-lib-base.umd.js.map +1 -1
- package/bundles/lenne.tech-ng-base.umd.js +15 -22
- package/bundles/lenne.tech-ng-base.umd.js.map +1 -1
- package/esm2015/lib/base/factories/apollo-options.factory.js +13 -23
- package/esm2015/lib/base/services/auth.service.js +4 -1
- package/esm2015/src/lib/base/factories/apollo-options.factory.js +13 -23
- package/esm2015/src/lib/base/services/auth.service.js +4 -1
- package/fesm2015/lenne.tech-ng-base-src-lib-base.js +15 -22
- package/fesm2015/lenne.tech-ng-base-src-lib-base.js.map +1 -1
- package/fesm2015/lenne.tech-ng-base.js +15 -22
- package/fesm2015/lenne.tech-ng-base.js.map +1 -1
- package/lib/base/services/auth.service.d.ts +2 -0
- package/package.json +1 -1
- package/src/lib/base/lenne.tech-ng-base-src-lib-base.metadata.json +1 -1
- package/src/lib/base/services/auth.service.d.ts +2 -0
|
@@ -541,8 +541,11 @@
|
|
|
541
541
|
return this._token.value;
|
|
542
542
|
},
|
|
543
543
|
set: function (token) {
|
|
544
|
+
var _a, _b;
|
|
544
545
|
this._token.next(token);
|
|
545
546
|
this.storageService.save('token', token);
|
|
547
|
+
(_a = this.subscriptionClient) === null || _a === void 0 ? void 0 : _a.close();
|
|
548
|
+
(_b = this.subscriptionClient) === null || _b === void 0 ? void 0 : _b.connect();
|
|
546
549
|
},
|
|
547
550
|
enumerable: false,
|
|
548
551
|
configurable: true
|
|
@@ -588,27 +591,17 @@
|
|
|
588
591
|
return forward(operation);
|
|
589
592
|
});
|
|
590
593
|
if (baseModuleConfig.wsUrl) {
|
|
591
|
-
var
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
else {
|
|
605
|
-
wsClient = new ws.WebSocketLink({
|
|
606
|
-
uri: baseModuleConfig.wsUrl,
|
|
607
|
-
options: {
|
|
608
|
-
reconnect: true,
|
|
609
|
-
},
|
|
610
|
-
});
|
|
611
|
-
}
|
|
594
|
+
var wsLink = new ws.WebSocketLink({
|
|
595
|
+
uri: baseModuleConfig.wsUrl,
|
|
596
|
+
options: {
|
|
597
|
+
reconnect: true,
|
|
598
|
+
connectionParams: function () { return ({
|
|
599
|
+
Authorization: authService.token ? 'Bearer ' + authService.token : undefined,
|
|
600
|
+
}); },
|
|
601
|
+
},
|
|
602
|
+
});
|
|
603
|
+
// Set client for reconnection on logout/login
|
|
604
|
+
authService.subscriptionClient = wsLink.subscriptionClient;
|
|
612
605
|
// using the ability to split links, you can send data to each link
|
|
613
606
|
// depending on what kind of operation is being sent
|
|
614
607
|
links.push(core.split(
|
|
@@ -618,7 +611,7 @@
|
|
|
618
611
|
// @ts-ignore
|
|
619
612
|
var _b = utilities.getMainDefinition(query), kind = _b.kind, operation = _b.operation;
|
|
620
613
|
return kind === 'OperationDefinition' && operation === 'subscription';
|
|
621
|
-
},
|
|
614
|
+
}, wsLink, core.concat(authMiddleware, http)));
|
|
622
615
|
}
|
|
623
616
|
else {
|
|
624
617
|
links.push(http);
|