@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 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
- if (!isAuthenticated.value && logtoClient.value?.isSignInRedirected(currentPageUrl)) {
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
- if (!isAuthenticated.value && logtoClient.value?.isSignInRedirected(currentPageUrl)) {
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/vue",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "type": "module",
5
5
  "main": "./lib/index.cjs",
6
6
  "module": "./lib/index.js",