@logto/vue 2.0.0 → 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,11 +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 &&
101
- logtoClient.value?.isSignInRedirected(currentPageUrl) &&
102
- !isLoading.value) {
103
+ const isAuthenticated = await logtoClient.value.isAuthenticated();
104
+ const isRedirected = await logtoClient.value.isSignInRedirected(currentPageUrl);
105
+ if (!isAuthenticated && isRedirected) {
103
106
  void handleSignInCallback(currentPageUrl, callback);
104
107
  }
105
108
  });
package/lib/index.js CHANGED
@@ -90,11 +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 &&
96
- logtoClient.value?.isSignInRedirected(currentPageUrl) &&
97
- !isLoading.value) {
98
+ const isAuthenticated = await logtoClient.value.isAuthenticated();
99
+ const isRedirected = await logtoClient.value.isSignInRedirected(currentPageUrl);
100
+ if (!isAuthenticated && isRedirected) {
98
101
  void handleSignInCallback(currentPageUrl, callback);
99
102
  }
100
103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/vue",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "type": "module",
5
5
  "main": "./lib/index.cjs",
6
6
  "module": "./lib/index.js",