Connecting modals where needed
This commit is contained in:
@ -115,7 +115,7 @@ type Props = {
|
||||
}
|
||||
/>
|
||||
|
||||
<Flex column>
|
||||
<Flex auto column>
|
||||
<Scrollable>
|
||||
<LinkSection>
|
||||
<SidebarLink to="/dashboard">
|
||||
|
@ -88,13 +88,15 @@ class Collection extends BaseModel {
|
||||
|
||||
@action delete = async () => {
|
||||
try {
|
||||
const res = await client.post('/collections.delete', { id: this.id });
|
||||
invariant(res && res.data, 'Data should be available');
|
||||
const { data } = res;
|
||||
return data.success;
|
||||
await client.post('/collections.delete', { id: this.id });
|
||||
this.emit('collections.delete', {
|
||||
id: this.id,
|
||||
});
|
||||
return true;
|
||||
} catch (e) {
|
||||
this.errors.add('Collection failed to delete');
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
updateData(data: Object = {}) {
|
||||
|
@ -186,10 +186,11 @@ class Document extends BaseModel {
|
||||
id: this.id,
|
||||
collectionId: this.collection.id,
|
||||
});
|
||||
return true;
|
||||
} catch (e) {
|
||||
this.errors.add('Error while deleting the document');
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
};
|
||||
|
||||
download() {
|
||||
|
@ -1,7 +1,8 @@
|
||||
// @flow
|
||||
import React, { Component } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { observer } from 'mobx-react';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import { homeUrl } from 'utils/routeHelpers';
|
||||
import Button from 'components/Button';
|
||||
import Flex from 'components/Flex';
|
||||
@ -57,4 +58,4 @@ type Props = {
|
||||
}
|
||||
}
|
||||
|
||||
export default CollectionDelete;
|
||||
export default inject('collections')(withRouter(CollectionDelete));
|
||||
|
@ -1,18 +1,17 @@
|
||||
// @flow
|
||||
import React, { Component } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { observer } from 'mobx-react';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import Button from 'components/Button';
|
||||
import Input from 'components/Input';
|
||||
import Flex from 'components/Flex';
|
||||
import HelpText from 'components/HelpText';
|
||||
import Collection from 'models/Collection';
|
||||
import CollectionsStore from 'stores/CollectionsStore';
|
||||
|
||||
type Props = {
|
||||
history: Object,
|
||||
collection: Collection,
|
||||
collections: CollectionsStore,
|
||||
onSubmit: () => void,
|
||||
};
|
||||
|
||||
@ -71,4 +70,4 @@ type Props = {
|
||||
}
|
||||
}
|
||||
|
||||
export default CollectionEdit;
|
||||
export default inject('collections')(withRouter(CollectionEdit));
|
||||
|
@ -1,7 +1,8 @@
|
||||
// @flow
|
||||
import React, { Component } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { observer } from 'mobx-react';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import Button from 'components/Button';
|
||||
import Input from 'components/Input';
|
||||
import HelpText from 'components/HelpText';
|
||||
@ -69,4 +70,4 @@ type Props = {
|
||||
}
|
||||
}
|
||||
|
||||
export default CollectionNew;
|
||||
export default inject('collections')(withRouter(CollectionNew));
|
||||
|
@ -1,7 +1,8 @@
|
||||
// @flow
|
||||
import React, { Component } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { observable } from 'mobx';
|
||||
import { observer } from 'mobx-react';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import { homeUrl } from 'utils/routeHelpers';
|
||||
import Button from 'components/Button';
|
||||
import Flex from 'components/Flex';
|
||||
@ -56,4 +57,4 @@ type Props = {
|
||||
}
|
||||
}
|
||||
|
||||
export default DocumentDelete;
|
||||
export default inject('documents')(withRouter(DocumentDelete));
|
||||
|
@ -65,7 +65,9 @@ class ApiClient {
|
||||
|
||||
// Handle 401, log out user
|
||||
if (response.status === 401) {
|
||||
return stores.auth.logout(() => (window.location = '/'));
|
||||
stores.auth.logout();
|
||||
window.location = '/';
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle failed responses
|
||||
|
@ -2476,11 +2476,7 @@ ee-first@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
|
||||
electron-to-chromium@^1.2.7:
|
||||
version "1.3.21"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.21.tgz#a967ebdcfe8ed0083fc244d1894022a8e8113ea2"
|
||||
|
||||
electron-to-chromium@^1.3.18:
|
||||
electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.18:
|
||||
version "1.3.20"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.20.tgz#2eedd5ccbae7ddc557f68ad1fce9c172e915e4e5"
|
||||
|
||||
|
Reference in New Issue
Block a user