Added favorites button to actor page.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user