More tree
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import Link from 'react-router/lib/Link';
|
||||
import History from 'utils/History';
|
||||
|
||||
import store from './AtlasStore';
|
||||
|
||||
@@ -16,7 +17,13 @@ import styles from './Atlas.scss';
|
||||
class Atlas extends React.Component {
|
||||
componentDidMount = () => {
|
||||
const { id } = this.props.params;
|
||||
store.fetchAtlas(id);
|
||||
store.fetchAtlas(id, data => {
|
||||
|
||||
// Forward directly to root document
|
||||
if (data.type === 'atlas') {
|
||||
History.replace(data.structure.url);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -8,7 +8,7 @@ const store = new class AtlasStore {
|
||||
|
||||
/* Actions */
|
||||
|
||||
@action fetchAtlas = async (id) => {
|
||||
@action fetchAtlas = async (id, successCallback) => {
|
||||
this.isFetching = true;
|
||||
this.atlas = null;
|
||||
|
||||
@@ -16,6 +16,7 @@ const store = new class AtlasStore {
|
||||
const res = await client.post('/atlases.info', { id: id });
|
||||
const { data } = res;
|
||||
this.atlas = data;
|
||||
successCallback(data);
|
||||
} catch (e) {
|
||||
console.error("Something went wrong");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user