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