chore: Change response of shares.info response for unshared document (#1666)

* Update server/api/share.js to send 204 status for unshared documents.

* Update shares.info endpoint to expect 204 in a few test.

* Update SharesStore and ApiClient to handle 204 status code
This commit is contained in:
Saumya Pandey
2020-12-01 12:19:15 +05:30
committed by GitHub
parent 183f06c2d1
commit 283b479689
4 changed files with 9 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
// @flow
import invariant from "invariant";
import { sortBy, filter, find } from "lodash";
import { sortBy, filter, find, isUndefined } from "lodash";
import { action, computed } from "mobx";
import Share from "models/Share";
import BaseStore from "./BaseStore";
@@ -47,6 +47,8 @@ export default class SharesStore extends BaseStore<Share> {
try {
const res = await client.post(`/${this.modelName}s.info`, { documentId });
if (isUndefined(res)) return;
invariant(res && res.data, "Data should be available");
this.addPolicies(res.policies);