@logto/vue 2.0.1 → 2.0.2
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.cjs +7 -2
- package/lib/index.js +7 -2
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -95,9 +95,14 @@ const useHandleSignInCallback = (callback) => {
|
|
|
95
95
|
}
|
|
96
96
|
const { isAuthenticated, isLoading, logtoClient, error } = context$1;
|
|
97
97
|
const { handleSignInCallback } = plugin.createPluginMethods(context$1);
|
|
98
|
-
vue.watchEffect(() => {
|
|
98
|
+
vue.watchEffect(async () => {
|
|
99
|
+
if (!logtoClient.value) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
99
102
|
const currentPageUrl = window.location.href;
|
|
100
|
-
|
|
103
|
+
const isAuthenticated = await logtoClient.value.isAuthenticated();
|
|
104
|
+
const isRedirected = await logtoClient.value.isSignInRedirected(currentPageUrl);
|
|
105
|
+
if (!isAuthenticated && isRedirected) {
|
|
101
106
|
void handleSignInCallback(currentPageUrl, callback);
|
|
102
107
|
}
|
|
103
108
|
});
|
package/lib/index.js
CHANGED
|
@@ -90,9 +90,14 @@ const useHandleSignInCallback = (callback) => {
|
|
|
90
90
|
}
|
|
91
91
|
const { isAuthenticated, isLoading, logtoClient, error } = context;
|
|
92
92
|
const { handleSignInCallback } = createPluginMethods(context);
|
|
93
|
-
watchEffect(() => {
|
|
93
|
+
watchEffect(async () => {
|
|
94
|
+
if (!logtoClient.value) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
94
97
|
const currentPageUrl = window.location.href;
|
|
95
|
-
|
|
98
|
+
const isAuthenticated = await logtoClient.value.isAuthenticated();
|
|
99
|
+
const isRedirected = await logtoClient.value.isSignInRedirected(currentPageUrl);
|
|
100
|
+
if (!isAuthenticated && isRedirected) {
|
|
96
101
|
void handleSignInCallback(currentPageUrl, callback);
|
|
97
102
|
}
|
|
98
103
|
});
|