@ichaingo/auth 1.1.0 → 1.2.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +23 -26
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as LoginApi } from './loginApi';
|
|
2
2
|
import { default as TokenManager } from '@ichaingo/token';
|
|
3
3
|
export declare function logout(): void;
|
|
4
|
-
export declare function fetchUserProfile(
|
|
4
|
+
export declare function fetchUserProfile(): Promise<any>;
|
|
5
5
|
export { TokenManager, LoginApi };
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,YAA0C,MAAM,iBAAiB,CAAA;AACxE,wBAAgB,MAAM,SAwBrB;AAED,wBAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,YAA0C,MAAM,iBAAiB,CAAA;AACxE,wBAAgB,MAAM,SAwBrB;AAED,wBAAgB,gBAAgB,iBAO/B;AAED,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as
|
|
3
|
-
import { getToken as
|
|
1
|
+
import n from "@ichaingo/request";
|
|
2
|
+
import { default as p } from "./loginApi.mjs";
|
|
3
|
+
import { getToken as i, removeAllToken as r } from "@ichaingo/token";
|
|
4
4
|
import { default as g } from "@ichaingo/token";
|
|
5
|
-
function
|
|
6
|
-
|
|
5
|
+
function c() {
|
|
6
|
+
n.get("/connect/logout", {
|
|
7
7
|
params: {
|
|
8
|
-
id_token_hint:
|
|
8
|
+
id_token_hint: i()
|
|
9
9
|
}
|
|
10
|
-
}).then((
|
|
11
|
-
var
|
|
12
|
-
if (((
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
10
|
+
}).then((e) => {
|
|
11
|
+
var o;
|
|
12
|
+
if (((o = e == null ? void 0 : e.status) == null ? void 0 : o.code) === 0) {
|
|
13
|
+
r();
|
|
14
|
+
const t = document.createElement("iframe");
|
|
15
|
+
t.src = `${process.env.NEXT_PUBLIC_AUTH_URL}/en/logout`, window.addEventListener("message", (a) => {
|
|
16
|
+
a.data.type === "logout" && (t.remove(), window.location.pathname.includes("/user-center") ? window.location.replace(process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL || "/") : window.location.reload());
|
|
17
|
+
}), t.style.display = "none", document.body.appendChild(t);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
const t = localStorage.getItem("userProfile");
|
|
29
|
-
return t ? Promise.resolve(JSON.parse(t)) : null;
|
|
21
|
+
function u() {
|
|
22
|
+
return n.get("/v2/users/profile").then((e) => {
|
|
23
|
+
var o;
|
|
24
|
+
if (((o = e == null ? void 0 : e.status) == null ? void 0 : o.code) === 0)
|
|
25
|
+
return e.data;
|
|
26
|
+
});
|
|
30
27
|
}
|
|
31
28
|
export {
|
|
32
|
-
|
|
29
|
+
p as LoginApi,
|
|
33
30
|
g as TokenManager,
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
u as fetchUserProfile,
|
|
32
|
+
c as logout
|
|
36
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/auth",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"js-cookie": "3.0.5",
|
|
27
|
-
"@ichaingo/request": "1.
|
|
28
|
-
"@ichaingo/token": "1.
|
|
27
|
+
"@ichaingo/request": "1.2.0",
|
|
28
|
+
"@ichaingo/token": "1.2.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/js-cookie": "^3.0.6",
|