diff --git a/src/client/accessor/document.ts b/src/client/accessor/document.ts index 36d25fa..89b4f56 100644 --- a/src/client/accessor/document.ts +++ b/src/client/accessor/document.ts @@ -15,6 +15,12 @@ export class FetchFailError implements Error{ } } export class ClientDocumentAccessor implements DocumentAccessor{ + async findByPath(basepath: string, filename?: string): Promise{ + throw new Error("not allowed"); + }; + async findDeleted(content_type: string): Promise{ + throw new Error("not allowed"); + }; async findList(option?: QueryListOption | undefined): Promise{ let res = await fetch(`${baseurl}/search?${option !== undefined ? toQueryString(option) : ""}`); if(res.status !== 200) throw new FetchFailError("findList Failed"); @@ -38,7 +44,10 @@ export class ClientDocumentAccessor implements DocumentAccessor{ const {id,...rest} = c; const res = await fetch(`${baseurl}/${id}`,{ method: "POST", - body: JSON.stringify(rest) + body: JSON.stringify(rest), + headers:{ + 'content-type':"application/json" + } }); const ret = await res.json(); return ret; @@ -47,7 +56,10 @@ export class ClientDocumentAccessor implements DocumentAccessor{ throw new Error("not allow"); const res = await fetch(`${baseurl}`,{ method: "POST", - body: JSON.stringify(c) + body: JSON.stringify(c), + headers:{ + 'content-type':"application/json" + } }); const ret = await res.json(); return ret; @@ -63,7 +75,10 @@ export class ClientDocumentAccessor implements DocumentAccessor{ const {id,...rest} = c; const res = await fetch(`${baseurl}/${id}/tags/${tag_name}`,{ method: "POST", - body: JSON.stringify(rest) + body: JSON.stringify(rest), + headers:{ + 'content-type':"application/json" + } }); const ret = await res.json(); return ret; @@ -72,7 +87,10 @@ export class ClientDocumentAccessor implements DocumentAccessor{ const {id,...rest} = c; const res = await fetch(`${baseurl}/${id}/tags/${tag_name}`,{ method: "DELETE", - body: JSON.stringify(rest) + body: JSON.stringify(rest), + headers:{ + 'content-type':"application/json" + } }); const ret = await res.json(); return ret;