diff --git a/materialious/src/app.html b/materialious/src/app.html
index e1839043..47019a56 100644
--- a/materialious/src/app.html
+++ b/materialious/src/app.html
@@ -12,7 +12,7 @@
%sveltekit.head%
-
+
%sveltekit.body%
diff --git a/materialious/src/lib/Api/index.ts b/materialious/src/lib/Api/index.ts
index 7d351342..f0a67105 100644
--- a/materialious/src/lib/Api/index.ts
+++ b/materialious/src/lib/Api/index.ts
@@ -6,27 +6,40 @@ export function buildPath(path: string): string {
return `${import.meta.env.VITE_DEFAULT_INVIDIOUS_INSTANCE}/api/v1/${path}`;
}
+export async function fetchErrorHandle(response: Response): Promise {
+ if (!response.ok) {
+ let message = 'Internal error';
+ try {
+ const json = await response.json();
+ message = 'errorBacktrace' in json ? json.errorBacktrace : json.error;
+ } catch { }
+ throw Error(message);
+ }
+
+ return response;
+}
+
export function buildAuthHeaders(): { headers: { Authorization: string; }; } {
return { headers: { Authorization: `Bearer ${get(auth)?.token}` } };
}
export async function getTrending(): Promise