@djangocfg/api 2.1.483 → 2.1.484
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/auth.cjs +15 -0
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +15 -0
- package/dist/auth.mjs.map +1 -1
- package/package.json +2 -2
- package/src/auth/context/AccountsContext.tsx +28 -0
package/dist/auth.mjs
CHANGED
|
@@ -4354,6 +4354,17 @@ var TokenRefreshRequestSchema = z34.object({
|
|
|
4354
4354
|
|
|
4355
4355
|
// src/auth/context/AccountsContext.tsx
|
|
4356
4356
|
import { jsx } from "react/jsx-runtime";
|
|
4357
|
+
function hasApiOrigin() {
|
|
4358
|
+
try {
|
|
4359
|
+
if (typeof process === "undefined" || !process.env) return false;
|
|
4360
|
+
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return true;
|
|
4361
|
+
if (process.env.NEXT_PUBLIC_API_PROXY_URL !== void 0) return true;
|
|
4362
|
+
return Boolean(process.env.NEXT_PUBLIC_API_URL);
|
|
4363
|
+
} catch {
|
|
4364
|
+
return false;
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
__name(hasApiOrigin, "hasApiOrigin");
|
|
4357
4368
|
var AccountsContext = createContext(void 0);
|
|
4358
4369
|
function AccountsProvider({ children }) {
|
|
4359
4370
|
const [profile, setProfile] = useState10(() => {
|
|
@@ -4377,6 +4388,10 @@ function AccountsProvider({ children }) {
|
|
|
4377
4388
|
const { trigger: triggerOtpVerify } = useCfgAccountsOtpVerifyCreate();
|
|
4378
4389
|
const refreshProfile = useCallback10(async (options) => {
|
|
4379
4390
|
const { callerId, force } = options || {};
|
|
4391
|
+
if (!hasApiOrigin()) {
|
|
4392
|
+
authLogger.debug(`No API origin configured, skipping profile fetch (caller: ${callerId})`);
|
|
4393
|
+
return void 0;
|
|
4394
|
+
}
|
|
4380
4395
|
if (isLoadingRef.current) {
|
|
4381
4396
|
authLogger.debug(`Profile loading in progress, skipping (caller: ${callerId})`);
|
|
4382
4397
|
return profileRef.current;
|