@eintrek/erp-shell 0.1.37 → 0.1.38
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.esm.js +13 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1908,7 +1908,19 @@ instance.interceptors.request.use(async (config) => {
|
|
|
1908
1908
|
if (token) {
|
|
1909
1909
|
config.headers.Authorization = `Bearer ${token}`;
|
|
1910
1910
|
}
|
|
1911
|
-
|
|
1911
|
+
// localStorage first, cookie second.
|
|
1912
|
+
//
|
|
1913
|
+
// Both are written by the same state machine, but not at the same moment:
|
|
1914
|
+
// setOrganizationId writes localStorage synchronously and then awaits a
|
|
1915
|
+
// server action for the cookie. Preferring the cookie meant every request
|
|
1916
|
+
// fired during that round trip carried the previous organisation — while
|
|
1917
|
+
// the query params, built from React state, already carried the new one.
|
|
1918
|
+
//
|
|
1919
|
+
// The backend scopes by this header and ignores organization_id in the
|
|
1920
|
+
// query, so those requests asked for organisation A and were handed B, and
|
|
1921
|
+
// the answer landed in the cache under A's key. No amount of cache clearing
|
|
1922
|
+
// reaches that: the entry is wrong, not stale.
|
|
1923
|
+
const organizationId = getOrganizationId() || getOrgFromCookie();
|
|
1912
1924
|
if (organizationId) {
|
|
1913
1925
|
config.headers["X-Organization-ID"] = organizationId;
|
|
1914
1926
|
}
|