@remit/web-client 0.0.332 → 0.0.334

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.
@@ -27,5 +27,13 @@ export declare class NetworkError extends Error {
27
27
  * breadcrumb (method, path, status, duration, correlation id) for bug reports.
28
28
  * A deliberate abort is not a request outcome worth reporting, so it is
29
29
  * re-thrown before any breadcrumb is written.
30
+ *
31
+ * Redirects are never followed. Behind Cloudflare Access an expired session
32
+ * answers with a 302 to the login page on another origin, which sends no CORS
33
+ * headers, so a followed redirect rejects as "Failed to fetch" and would read
34
+ * as an offline blip. No API route redirects a fetch, so an opaque redirect
35
+ * means the session is gone and becomes a 401, the signed-out path. The
36
+ * `redirect` in `init` overrides the one on a `Request` input, which is what
37
+ * the generated client passes.
30
38
  */
31
39
  export declare const taggedFetch: typeof fetch;
@@ -46,11 +46,22 @@ const isDeliberateAbort = (error) => typeof error === "object" &&
46
46
  * breadcrumb (method, path, status, duration, correlation id) for bug reports.
47
47
  * A deliberate abort is not a request outcome worth reporting, so it is
48
48
  * re-thrown before any breadcrumb is written.
49
+ *
50
+ * Redirects are never followed. Behind Cloudflare Access an expired session
51
+ * answers with a 302 to the login page on another origin, which sends no CORS
52
+ * headers, so a followed redirect rejects as "Failed to fetch" and would read
53
+ * as an offline blip. No API route redirects a fetch, so an opaque redirect
54
+ * means the session is gone and becomes a 401, the signed-out path. The
55
+ * `redirect` in `init` overrides the one on a `Request` input, which is what
56
+ * the generated client passes.
49
57
  */
50
58
  export const taggedFetch = async (input, init) => {
51
59
  const startedAt = performance.now();
52
60
  try {
53
- const response = await fetch(input, init);
61
+ const received = await fetch(input, { ...init, redirect: "manual" });
62
+ const response = received.type === "opaqueredirect"
63
+ ? new Response(null, { status: 401 })
64
+ : received;
54
65
  recordRequest({
55
66
  input,
56
67
  init,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client",
3
- "version": "0.0.332",
3
+ "version": "0.0.334",
4
4
  "type": "module",
5
5
  "description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
6
6
  "exports": {
@@ -91,7 +91,7 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "@hookform/resolvers": "5.4.0",
94
- "@remit/ui": "0.0.228",
94
+ "@remit/ui": "0.0.229",
95
95
  "@tanstack/react-query": "5.101.2",
96
96
  "@tanstack/react-query-devtools": "5.101.2",
97
97
  "@tanstack/react-router": "1.170.18",