zavadil-ts-common 1.1.70 → 1.1.71
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/dist/index.d.ts +4 -7
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth/OAuthRestClient.d.ts +3 -6
- package/dist/oauth/RestClientWithOAuth.d.ts +1 -1
- package/dist/util/JsonUtil.d.ts +1 -0
- package/package.json +1 -1
- package/src/oauth/OAuthRestClient.ts +1 -2
- package/src/oauth/OAuthTokenManager.ts +7 -8
- package/src/oauth/RestClientWithOAuth.ts +3 -9
- package/src/util/JsonUtil.ts +4 -0
@@ -3,6 +3,7 @@ import {RestClient, RestClientHeaders} from "../client";
|
|
3
3
|
import {IdTokenPayload} from "./OAuthRestClient";
|
4
4
|
import {LazyAsync} from "../cache";
|
5
5
|
import {DateUtil, StringUtil} from "../util";
|
6
|
+
import {JsonUtil} from "../util/JsonUtil";
|
6
7
|
|
7
8
|
export type ServerOAuthInfoPayload = {
|
8
9
|
debugMode?: boolean;
|
@@ -85,15 +86,8 @@ export class RestClientWithOAuth extends RestClient {
|
|
85
86
|
return up.get('token');
|
86
87
|
}
|
87
88
|
|
88
|
-
getIdTokenFromLocalStorage(): IdTokenPayload | null {
|
89
|
-
|
90
|
-
if (!raw) return null;
|
91
|
-
const obj = JSON.parse(raw);
|
92
|
-
return {
|
93
|
-
idToken: obj.idToken,
|
94
|
-
issuedAt: DateUtil.parseDate(obj.issuedAt) || new Date(),
|
95
|
-
expires: DateUtil.parseDate(obj.expires)
|
96
|
-
}
|
89
|
+
getIdTokenFromLocalStorage(): IdTokenPayload | null | undefined {
|
90
|
+
return JsonUtil.parse(localStorage.getItem('id-token'));
|
97
91
|
}
|
98
92
|
|
99
93
|
saveIdTokenToLocalStorage(token: IdTokenPayload | null) {
|
package/src/util/JsonUtil.ts
CHANGED