Separated GET and POST calls
This commit is contained in:
@ -4,7 +4,7 @@ export default function methodOverride(options) {
|
||||
return async function methodOverrideMiddleware(ctx, next) {
|
||||
if (ctx.method === 'POST') {
|
||||
ctx.body = ctx.request.body;
|
||||
} else {
|
||||
} else if (ctx.method === 'GET') {
|
||||
ctx.method= 'POST';
|
||||
ctx.body = queryString.parse(ctx.querystring);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ const store = new class AtlasStore {
|
||||
this.atlas = null;
|
||||
|
||||
try {
|
||||
const res = await client.post('/atlases.info', { id: id });
|
||||
const res = await client.get('/atlases.info', { id: id });
|
||||
const { data } = res;
|
||||
this.atlas = data;
|
||||
successCallback(data);
|
||||
|
@ -39,7 +39,7 @@ class DocumentEditStore {
|
||||
this.isFetching = true;
|
||||
|
||||
try {
|
||||
const data = await client.post('/documents.info', {
|
||||
const data = await client.get('/documents.info', {
|
||||
id: this.documentId,
|
||||
});
|
||||
if (this.newChildDocument) {
|
||||
|
@ -48,7 +48,7 @@ class DocumentSceneStore {
|
||||
this.updatingContent = softLoad;
|
||||
|
||||
try {
|
||||
const res = await client.post('/documents.info', { id: id });
|
||||
const res = await client.get('/documents.info', { id: id });
|
||||
const { data } = res;
|
||||
runInAction('fetchDocument', () => {
|
||||
this.document = data;
|
||||
|
@ -18,7 +18,7 @@ class SearchStore {
|
||||
|
||||
if (query) {
|
||||
try {
|
||||
const res = await client.post('/documents.search', { query });
|
||||
const res = await client.get('/documents.search', { query });
|
||||
const { data, pagination } = res;
|
||||
runInAction('search document', () => {
|
||||
this.documents = data;
|
||||
|
@ -77,10 +77,14 @@ class ApiClient {
|
||||
});
|
||||
}
|
||||
|
||||
post = (path, data) => {
|
||||
get = (path, data) => {
|
||||
return this.fetch(path, 'GET', data);
|
||||
}
|
||||
|
||||
post = (path, data) => {
|
||||
return this.fetch(path, 'POST', data);
|
||||
}
|
||||
|
||||
// Helpers
|
||||
|
||||
constructQueryString = (data) => {
|
||||
|
Reference in New Issue
Block a user