1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

Fix an error in fetch.ts (probably the source of these build issues)

This commit is contained in:
Cooper 2024-09-23 11:42:49 +00:00 committed by GitHub
parent fad6316020
commit 7495d51408
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,7 +69,12 @@ export async function singularProxiedFetch<T>(
onResponse(context) {
const tokenHeader = context.response.headers.get("X-Token");
if (tokenHeader) setApiToken(tokenHeader);
ops.onResponse?.(context);
if (Array.isArray(ops.onResponse)) {
ops.onResponse.forEach((hook) => hook(context));
} else {
ops.onResponse?.(context);
}
},
});
}