This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/frontend/scenes/Atlas/AtlasStore.js
2016-08-05 18:09:14 +03:00

28 lines
611 B
JavaScript

import { observable, action } from 'mobx';
import { client } from 'utils/ApiClient';
const store = new class AtlasStore {
@observable collection;
@observable isFetching = true;
/* Actions */
@action fetchCollection = async (id, successCallback) => {
this.isFetching = true;
this.collection = null;
try {
const res = await client.get('/collections.info', { id });
const { data } = res;
this.collection = data;
successCallback(data);
} catch (e) {
console.error("Something went wrong");
}
this.isFetching = false;
}
}();
export default store;