Added basic actor page with scenes and co-star filtering.
This commit is contained in:
10
src/api.js
10
src/api.js
@@ -1,3 +1,5 @@
|
||||
import { parse } from '@brillout/json-serializer/parse';
|
||||
|
||||
const postHeaders = {
|
||||
mode: 'cors',
|
||||
credentials: 'same-origin',
|
||||
@@ -18,7 +20,7 @@ function getQuery(data) {
|
||||
|
||||
export async function get(path, query = {}) {
|
||||
const res = await fetch(`/api${path}${getQuery(query)}`);
|
||||
const body = await res.json();
|
||||
const body = parse(await res.text());
|
||||
|
||||
if (res.ok) {
|
||||
return body;
|
||||
@@ -38,7 +40,7 @@ export async function post(path, data, { query } = {}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const body = await res.json();
|
||||
const body = parse(await res.text());
|
||||
|
||||
if (res.ok) {
|
||||
return body;
|
||||
@@ -58,7 +60,7 @@ export async function patch(path, data, { query } = {}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const body = await res.json();
|
||||
const body = parse(await res.text());
|
||||
|
||||
if (res.ok) {
|
||||
return body;
|
||||
@@ -78,7 +80,7 @@ export async function del(path, { data, query } = {}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const body = await res.json();
|
||||
const body = parse(await res.text());
|
||||
|
||||
if (res.ok) {
|
||||
return body;
|
||||
|
||||
Reference in New Issue
Block a user