mirror of
https://github.com/cstaelen/shazarr.git
synced 2026-10-19 01:31:11 -05:00
fix(tidarr): network error message (#280)
This commit is contained in:
1 parent
5bfd54ab2c
commit
1e369a09fb
3 files changed
+15
-13
No files matched your search
@@ -33,5 +33,5 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"minSdkVersionForDexing": 35
|
||||
"minSdkVersionForDexing": 24
|
||||
}
|
||||
Vendored
+1
-4
@@ -24,10 +24,7 @@
|
||||
})();
|
||||
</script>
|
||||
<!-- End Matomo Code -->
|
||||
<script type="module" crossorigin src="/assets/index-D7VFqCwT.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/definitions-DpxdDAAq.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/dist-DtWIdkI-.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/definitions-DT1Amp_1.js">
|
||||
<script type="module" crossorigin src="/assets/index-BocVoKV2.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -39,14 +39,19 @@ async function request<T>(
|
||||
path: string,
|
||||
options: RequestInit = {}
|
||||
): Promise<T> {
|
||||
const res = await fetch(`${config.url.replace(/\/$/, "")}${path}`, {
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Api-Key": config.apiKey,
|
||||
...(options.headers ?? {}),
|
||||
},
|
||||
});
|
||||
let res: Response;
|
||||
try {
|
||||
res = await fetch(`${config.url.replace(/\/$/, "")}${path}`, {
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Api-Key": config.apiKey,
|
||||
...(options.headers ?? {}),
|
||||
},
|
||||
});
|
||||
} catch {
|
||||
throw new Error("Tidarr unreachable");
|
||||
}
|
||||
const contentType = res.headers.get("content-type") ?? "";
|
||||
if (!res.ok) {
|
||||
const body = contentType.includes("application/json") ? await res.text() : "";
|
||||
|
||||
Reference in new issue
Block a user