@logto/vue 0.1.12 → 0.1.15
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/lib/index.d.ts +1 -1
- package/lib/index.js +3 -3
- package/lib/plugin.d.ts +1 -1
- package/lib/plugin.js +3 -3
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export declare const useLogto: () => Logto;
|
|
|
73
73
|
*
|
|
74
74
|
* Use this in the setup script of your Callback page to make sure the injection works
|
|
75
75
|
*/
|
|
76
|
-
export declare const useHandleSignInCallback: (
|
|
76
|
+
export declare const useHandleSignInCallback: (callback?: (() => void) | undefined) => {
|
|
77
77
|
isLoading: Readonly<Ref<boolean>>;
|
|
78
78
|
isAuthenticated: Readonly<Ref<boolean>>;
|
|
79
79
|
error: Readonly<Ref<Error | undefined>>;
|
package/lib/index.js
CHANGED
|
@@ -92,17 +92,17 @@ exports.useLogto = useLogto;
|
|
|
92
92
|
*
|
|
93
93
|
* Use this in the setup script of your Callback page to make sure the injection works
|
|
94
94
|
*/
|
|
95
|
-
const useHandleSignInCallback = (
|
|
95
|
+
const useHandleSignInCallback = (callback) => {
|
|
96
96
|
const context = (0, vue_1.inject)(consts_1.contextInjectionKey);
|
|
97
97
|
if (!context) {
|
|
98
98
|
return (0, context_1.throwContextError)();
|
|
99
99
|
}
|
|
100
|
-
const currentPageUrl = window.location.href;
|
|
101
100
|
const { isAuthenticated, isLoading, logtoClient, error } = context;
|
|
102
101
|
const { handleSignInCallback } = (0, plugin_1.createPluginMethods)(context);
|
|
103
102
|
(0, vue_1.watchEffect)(() => {
|
|
103
|
+
const currentPageUrl = window.location.href;
|
|
104
104
|
if (!isAuthenticated.value && logtoClient.value?.isSignInRedirected(currentPageUrl)) {
|
|
105
|
-
void handleSignInCallback(currentPageUrl,
|
|
105
|
+
void handleSignInCallback(currentPageUrl, callback);
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
return {
|
package/lib/plugin.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export declare const createPluginMethods: (context: Context) => {
|
|
|
12
12
|
iat: number;
|
|
13
13
|
at_hash?: string | undefined;
|
|
14
14
|
} | undefined;
|
|
15
|
-
handleSignInCallback: (callbackUri: string,
|
|
15
|
+
handleSignInCallback: (callbackUri: string, callbackFunction?: (() => void) | undefined) => Promise<undefined>;
|
|
16
16
|
};
|
package/lib/plugin.js
CHANGED
|
@@ -28,7 +28,7 @@ const createPluginMethods = (context) => {
|
|
|
28
28
|
await logtoClient.value.signOut(postLogoutRedirectUri);
|
|
29
29
|
// We deliberately do NOT set isAuthenticated to false here, because the app state may change immediately
|
|
30
30
|
// even before navigating to the oidc end session endpoint, which might cause rendering problems.
|
|
31
|
-
//
|
|
31
|
+
// Moreover, since the location will be redirected, the isAuthenticated state will not matter any more.
|
|
32
32
|
}
|
|
33
33
|
catch (error) {
|
|
34
34
|
setError(error, 'Unexpected error occurred while signing out.');
|
|
@@ -78,7 +78,7 @@ const createPluginMethods = (context) => {
|
|
|
78
78
|
setError(error, 'Unexpected error occurred while getting id token claims.');
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
const handleSignInCallback = async (callbackUri,
|
|
81
|
+
const handleSignInCallback = async (callbackUri, callbackFunction) => {
|
|
82
82
|
if (!logtoClient.value) {
|
|
83
83
|
return (0, context_1.throwContextError)();
|
|
84
84
|
}
|
|
@@ -86,7 +86,7 @@ const createPluginMethods = (context) => {
|
|
|
86
86
|
setLoading(true);
|
|
87
87
|
await logtoClient.value.handleSignInCallback(callbackUri);
|
|
88
88
|
setIsAuthenticated(true);
|
|
89
|
-
|
|
89
|
+
callbackFunction?.();
|
|
90
90
|
}
|
|
91
91
|
catch (error) {
|
|
92
92
|
setError(error, 'Unexpected error occurred while handling sign in callback.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"exports": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"prepack": "pnpm test"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@logto/browser": "^0.1.
|
|
27
|
+
"@logto/browser": "^0.1.14"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@jest/types": "^27.5.1",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/jest": "^27.4.1",
|
|
34
34
|
"eslint": "^8.9.0",
|
|
35
35
|
"jest": "^27.5.1",
|
|
36
|
-
"lint-staged": "^
|
|
36
|
+
"lint-staged": "^13.0.0",
|
|
37
37
|
"postcss": "^8.4.6",
|
|
38
38
|
"prettier": "^2.5.1",
|
|
39
39
|
"stylelint": "^14.8.2",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "51665f47934ef390136ee8ff53393f20f9fb8221"
|
|
65
65
|
}
|