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