call setSpinner properly

This commit is contained in:
Isaac Visintainer 2019-07-04 11:26:37 -07:00
parent 767535b4d8
commit 3cf2af8f12
4 changed files with 9 additions and 45 deletions

View File

@ -4,7 +4,6 @@ import { PostPreview } from '/components/lib/post-preview';
import _ from 'lodash'; import _ from 'lodash';
import { PathControl } from '/components/lib/path-control'; import { PathControl } from '/components/lib/path-control';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import { store } from '/store';
const PC = withRouter(PathControl); const PC = withRouter(PathControl);
@ -38,11 +37,7 @@ export class Blog extends Component {
], ],
}); });
store.handleEvent({ this.props.setSpinner(false);
data: {
spinner: false,
}
});
} }
} }
@ -67,11 +62,7 @@ export class Blog extends Component {
temporary: true, temporary: true,
}); });
store.handleEvent({ this.props.setSpinner(true);
data: {
spinner: true,
}
});
this.props.api.bind(`/collection/${blogId}`, "PUT", ship, "write", this.props.api.bind(`/collection/${blogId}`, "PUT", ship, "write",
this.handleEvent.bind(this), this.handleEvent.bind(this),

View File

@ -3,7 +3,6 @@ import classnames from 'classnames';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { PathControl } from '/components/lib/path-control'; import { PathControl } from '/components/lib/path-control';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import { store } from '/store';
const PC = withRouter(PathControl); const PC = withRouter(PathControl);
@ -97,11 +96,7 @@ export class NewBlog extends Component {
awaiting: blogId awaiting: blogId
}); });
store.handleEvent({ this.props.setSpinner(true);
data: {
spinner: true,
}
});
this.props.api.action("write", "write-action", makeBlog); this.props.api.action("write", "write-action", makeBlog);
this.props.api.action("write", "write-action", sendInvites); this.props.api.action("write", "write-action", sendInvites);
@ -110,11 +105,7 @@ export class NewBlog extends Component {
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if (this.state.awaiting) { if (this.state.awaiting) {
if (this.props.pubs[this.state.awaiting]) { if (this.props.pubs[this.state.awaiting]) {
store.handleEvent({ this.props.setSpinner(false);
data: {
spinner: false,
}
});
this.props.history.push(`/~publish/~${window.ship}/${this.state.awaiting}`); this.props.history.push(`/~publish/~${window.ship}/${this.state.awaiting}`);
} }
} }

View File

@ -8,7 +8,6 @@ import { Comments } from '/components/lib/comments';
import { PathControl } from '/components/lib/path-control'; import { PathControl } from '/components/lib/path-control';
import { NextPrev } from '/components/lib/next-prev'; import { NextPrev } from '/components/lib/next-prev';
import _ from 'lodash'; import _ from 'lodash';
import { store } from '/store';
export class Post extends Component { export class Post extends Component {
constructor(props){ constructor(props){
@ -103,11 +102,7 @@ export class Post extends Component {
} }
}); });
store.handleEvent({ this.props.setSpinner(true);
data: {
spinner: true,
}
});
this.props.api.action("write", "write-action", data); this.props.api.action("write", "write-action", data);
} }
@ -161,11 +156,7 @@ export class Post extends Component {
temporary: true, temporary: true,
}); });
store.handleEvent({ this.props.setSpinner(true);
data: {
spinner: true,
}
});
this.props.api.bind(`/collection/${blogId}`, "PUT", ship, "write", this.props.api.bind(`/collection/${blogId}`, "PUT", ship, "write",
this.handleEvent.bind(this), this.handleEvent.bind(this),
@ -219,11 +210,7 @@ export class Post extends Component {
], ],
}); });
store.handleEvent({ this.props.setSpinner(false);
data: {
spinner: false,
}
});
} else if (diff.data.collection) { } else if (diff.data.collection) {
let newBlog = this.state.blog; let newBlog = this.state.blog;
@ -285,11 +272,7 @@ export class Post extends Component {
post: post, post: post,
}); });
store.handleEvent({ this.props.setSpinner(false);
data: {
spinner: false,
}
});
} }
if (!this.state.temporary){ if (!this.state.temporary){

View File

@ -7,7 +7,6 @@ import _ from 'lodash';
import { api } from '/api'; import { api } from '/api';
import { store } from '/store'; import { store } from '/store';
import { Recent } from '/components/recent'; import { Recent } from '/components/recent';
import { New } from '/components/new';
import { NewBlog } from '/components/new-blog'; import { NewBlog } from '/components/new-blog';
import { NewPost } from '/components/new-post'; import { NewPost } from '/components/new-post';
import { Skeleton } from '/components/skeleton'; import { Skeleton } from '/components/skeleton';