Added favorites button to actor page.

This commit is contained in:
DebaucheryLibrarian
2021-03-15 03:30:47 +01:00
parent e371e9725a
commit 77b40817f2
27 changed files with 466 additions and 169 deletions

View File

@@ -10,10 +10,16 @@ async function get(endpoint, query = {}) {
credentials: 'same-origin',
});
if (res.ok) {
const contentTypes = res.headers.get('content-type');
if (res.ok && contentTypes?.includes('application/json')) {
return res.json();
}
if (res.ok) {
return null;
}
const errorMsg = await res.text();
throw new Error(errorMsg);
@@ -30,10 +36,16 @@ async function post(endpoint, data) {
body: JSON.stringify(data),
});
if (res.ok) {
const contentTypes = res.headers.get('content-type');
if (res.ok && contentTypes?.includes('application/json')) {
return res.json();
}
if (res.ok) {
return null;
}
const errorMsg = await res.text();
throw new Error(errorMsg);