@sanvika/auth 2.5.2 → 2.5.3
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.js +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var SanvikaAuthContext = createContext(null);
|
|
|
17
17
|
function SanvikaAuthProvider({
|
|
18
18
|
children,
|
|
19
19
|
clientId,
|
|
20
|
+
redirectUri,
|
|
20
21
|
dashboardPath
|
|
21
22
|
}) {
|
|
22
23
|
const [user, setUser] = useState(null);
|
|
@@ -102,6 +103,7 @@ function SanvikaAuthProvider({
|
|
|
102
103
|
setAuth,
|
|
103
104
|
authFetch,
|
|
104
105
|
clientId,
|
|
106
|
+
redirectUri,
|
|
105
107
|
dashboardPath
|
|
106
108
|
};
|
|
107
109
|
return /* @__PURE__ */ jsx(SanvikaAuthContext.Provider, { value, children });
|
|
@@ -273,7 +275,7 @@ function SanvikaAccountButtonContent({
|
|
|
273
275
|
}
|
|
274
276
|
if (!isAuthenticated || loading) {
|
|
275
277
|
const { clientId } = auth;
|
|
276
|
-
const redirectUri = typeof window !== "undefined" ? window.location.origin + "/auth/callback" : "";
|
|
278
|
+
const redirectUri = auth.redirectUri || (typeof window !== "undefined" && window.location ? window.location.origin + "/auth/callback" : "");
|
|
277
279
|
const authorizeUrl = clientId && redirectUri ? `${S_AUTH_URL2}/authorize?client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUri)}` : `${S_AUTH_URL2}/authorize`;
|
|
278
280
|
return /* @__PURE__ */ jsxs(
|
|
279
281
|
"button",
|