@volr/react 0.1.74 → 0.1.76
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.cjs +6 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -18706,7 +18706,7 @@ function useVolrAuthCallback(options = {}) {
|
|
|
18706
18706
|
const { clearUrlParams = true } = options;
|
|
18707
18707
|
const { setUser } = useVolrContext();
|
|
18708
18708
|
const { setAccessToken, setRefreshToken, client } = useInternalAuth();
|
|
18709
|
-
const [isLoading, setIsLoading] = useState(
|
|
18709
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
18710
18710
|
const [error, setError] = useState(null);
|
|
18711
18711
|
const [isNewUser, setIsNewUser] = useState(false);
|
|
18712
18712
|
const [user, setLocalUser] = useState(null);
|
|
@@ -18730,12 +18730,16 @@ function useVolrAuthCallback(options = {}) {
|
|
|
18730
18730
|
const handleCallback = async () => {
|
|
18731
18731
|
if (typeof window === "undefined") return;
|
|
18732
18732
|
if (hasProcessed.current) return;
|
|
18733
|
-
hasProcessed.current = true;
|
|
18734
18733
|
const searchParams = new URLSearchParams(window.location.search);
|
|
18735
18734
|
const authCode = searchParams.get("code");
|
|
18736
18735
|
const errorParam = searchParams.get("error");
|
|
18737
18736
|
const isNew = searchParams.get("isNewUser") === "true";
|
|
18738
18737
|
const warning = searchParams.get("warning");
|
|
18738
|
+
if (!authCode && !errorParam) {
|
|
18739
|
+
return;
|
|
18740
|
+
}
|
|
18741
|
+
hasProcessed.current = true;
|
|
18742
|
+
setIsLoading(true);
|
|
18739
18743
|
if (warning) {
|
|
18740
18744
|
console.warn(`[Volr] ${warning}`);
|
|
18741
18745
|
}
|
|
@@ -18746,13 +18750,6 @@ function useVolrAuthCallback(options = {}) {
|
|
|
18746
18750
|
options.onError?.(errorMsg);
|
|
18747
18751
|
return;
|
|
18748
18752
|
}
|
|
18749
|
-
if (!authCode) {
|
|
18750
|
-
const errorMsg = "No authorization code found. Please try logging in again.";
|
|
18751
|
-
setError(errorMsg);
|
|
18752
|
-
setIsLoading(false);
|
|
18753
|
-
options.onError?.(errorMsg);
|
|
18754
|
-
return;
|
|
18755
|
-
}
|
|
18756
18753
|
if (!authCode.startsWith("volr_auth_")) {
|
|
18757
18754
|
const errorMsg = "Invalid authorization code format";
|
|
18758
18755
|
setError(errorMsg);
|