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