fix: API response

This commit is contained in:
Tom Moor
2020-12-26 23:12:22 -08:00
parent 7021c2a9e5
commit c8cd7fcf4a
7 changed files with 38 additions and 18 deletions

View File

@@ -97,12 +97,12 @@ export default class CollectionsStore extends BaseStore<Collection> {
if (path) return path.title;
}
delete(collection: Collection) {
super.delete(collection);
delete = async (collection: Collection) => {
await super.delete(collection);
this.rootStore.documents.fetchRecentlyUpdated();
this.rootStore.documents.fetchRecentlyViewed();
}
};
export = () => {
return client.post("/collections.export_all");

View File

@@ -503,7 +503,11 @@ export default class DocumentsStore extends BaseStore<Document> {
formData.append("type", "outline");
formData.append("file", file);
await client.post("/documents.batchImport", formData);
const res = await client.post("/documents.batchImport", formData);
invariant(res && res.data, "Data should be available");
this.addPolicies(res.policies);
res.data.collections.forEach(this.rootStore.collections.add);
};
@action