@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.cjs
CHANGED
|
@@ -4416,6 +4416,17 @@ var TokenRefreshRequestSchema = import_zod34.z.object({
|
|
|
4416
4416
|
|
|
4417
4417
|
// src/auth/context/AccountsContext.tsx
|
|
4418
4418
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
4419
|
+
function hasApiOrigin() {
|
|
4420
|
+
try {
|
|
4421
|
+
if (typeof process === "undefined" || !process.env) return false;
|
|
4422
|
+
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return true;
|
|
4423
|
+
if (process.env.NEXT_PUBLIC_API_PROXY_URL !== void 0) return true;
|
|
4424
|
+
return Boolean(process.env.NEXT_PUBLIC_API_URL);
|
|
4425
|
+
} catch {
|
|
4426
|
+
return false;
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
__name(hasApiOrigin, "hasApiOrigin");
|
|
4419
4430
|
var AccountsContext = (0, import_react15.createContext)(void 0);
|
|
4420
4431
|
function AccountsProvider({ children }) {
|
|
4421
4432
|
const [profile, setProfile] = (0, import_react15.useState)(() => {
|
|
@@ -4439,6 +4450,10 @@ function AccountsProvider({ children }) {
|
|
|
4439
4450
|
const { trigger: triggerOtpVerify } = useCfgAccountsOtpVerifyCreate();
|
|
4440
4451
|
const refreshProfile = (0, import_react15.useCallback)(async (options) => {
|
|
4441
4452
|
const { callerId, force } = options || {};
|
|
4453
|
+
if (!hasApiOrigin()) {
|
|
4454
|
+
authLogger.debug(`No API origin configured, skipping profile fetch (caller: ${callerId})`);
|
|
4455
|
+
return void 0;
|
|
4456
|
+
}
|
|
4442
4457
|
if (isLoadingRef.current) {
|
|
4443
4458
|
authLogger.debug(`Profile loading in progress, skipping (caller: ${callerId})`);
|
|
4444
4459
|
return profileRef.current;
|