Added further types and moved types
This commit is contained in:
@@ -1,25 +1,29 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import { withRouter } from 'react-router';
|
||||
import { Flex } from 'reflexbox';
|
||||
|
||||
import DashboardStore from './DashboardStore';
|
||||
|
||||
import { Flex } from 'reflexbox';
|
||||
import Layout from 'components/Layout';
|
||||
import AtlasPreview from 'components/AtlasPreview';
|
||||
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
||||
import CenteredContent from 'components/CenteredContent';
|
||||
|
||||
type Props = {
|
||||
user: Object,
|
||||
router: Object,
|
||||
};
|
||||
|
||||
@withRouter
|
||||
@inject('user')
|
||||
@observer
|
||||
class Dashboard extends React.Component {
|
||||
static propTypes = {
|
||||
user: React.PropTypes.object.isRequired,
|
||||
router: React.PropTypes.object.isRequired,
|
||||
};
|
||||
props: Props;
|
||||
store: DashboardStore;
|
||||
|
||||
constructor(props) {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.store = new DashboardStore({
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
// @flow
|
||||
import { observable, action, runInAction } from 'mobx';
|
||||
import { client } from 'utils/ApiClient';
|
||||
import type { Pagination, Collection } from 'types';
|
||||
|
||||
type Options = {
|
||||
team: Object,
|
||||
router: Object,
|
||||
};
|
||||
|
||||
class DashboardStore {
|
||||
@observable collections;
|
||||
@observable pagination;
|
||||
team: Object;
|
||||
router: Object;
|
||||
@observable collections: Array<Collection>;
|
||||
@observable pagination: Pagination;
|
||||
|
||||
@observable isFetching = true;
|
||||
@observable isFetching: boolean = true;
|
||||
|
||||
/* Actions */
|
||||
|
||||
@@ -19,18 +28,13 @@ class DashboardStore {
|
||||
this.collections = data;
|
||||
this.pagination = pagination;
|
||||
});
|
||||
|
||||
// If only one collection, visit it automatically
|
||||
if (this.collections.length === 1) {
|
||||
this.router.push(this.collections[0].url);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Something went wrong');
|
||||
}
|
||||
this.isFetching = false;
|
||||
};
|
||||
|
||||
constructor(options) {
|
||||
constructor(options: Options) {
|
||||
this.team = options.team;
|
||||
this.router = options.router;
|
||||
this.fetchCollections();
|
||||
|
||||
@@ -3,14 +3,14 @@ import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import styled from 'styled-components';
|
||||
import { Flex } from 'reflexbox';
|
||||
|
||||
import ApiKeyRow from './components/ApiKeyRow';
|
||||
import styles from './Settings.scss';
|
||||
import SettingsStore from './SettingsStore';
|
||||
|
||||
import Layout, { Title } from 'components/Layout';
|
||||
import CenteredContent from 'components/CenteredContent';
|
||||
import SlackAuthLink from 'components/SlackAuthLink';
|
||||
import ApiKeyRow from './components/ApiKeyRow';
|
||||
|
||||
import styles from './Settings.scss';
|
||||
|
||||
import SettingsStore from './SettingsStore';
|
||||
|
||||
@observer class Settings extends React.Component {
|
||||
store = SettingsStore;
|
||||
|
||||
Reference in New Issue
Block a user