#find @method -rename

This commit is contained in:
Alex
2018-06-23 22:35:56 +03:00
parent 7c4fbdb5a1
commit 37f9954f11
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -11,9 +11,9 @@ export const logOut = () => fetcher.get({ url: `/auth/logout`, overriddenApiBase
export const getConfig = () => fetcher.get(`/config`);
// TODO: looks like we can get url from settings here and below
export const find = ({ sort, url }) => fetcher.get(`/find?url=${url}&sort=${sort}&format=tree`);
export const getPostComments = ({ sort, url }) => fetcher.get(`/find?url=${url}&sort=${sort}&format=tree`);
export const last = ({ siteId, max }) => fetcher.get(`/last/${max}?site=${siteId}`);
export const getLastComments = ({ siteId, max }) => fetcher.get(`/last/${max}?site=${siteId}`);
export const counts = ({ urls, siteId }) => fetcher.post({
url: `/counts?site=${siteId}`,
@@ -107,7 +107,7 @@ export const getBlocked = () => fetcher.get({
export default {
logOut,
getConfig,
find,
getPostComments,
last,
counts,
getComment,
+3 -3
View File
@@ -62,7 +62,7 @@ export default class Root extends Component {
api.getUser()
.then(data => store.set('user', data))
.catch(() => store.set('user', {})),
api.find({ sort, url })
api.getPostComments({ sort, url })
.then(({ comments = [] } = {}) => store.set('comments', comments))
.catch(() => store.set('comments', [])),
]).finally(() => {
@@ -133,7 +133,7 @@ export default class Root extends Component {
// if someone was unblocked let's reload comments
if (wasSomeoneUnblocked) {
api.find({ sort, url }).then(({ comments } = {}) => store.set('comments', comments));
api.getPostComments({ sort, url }).then(({ comments } = {}) => store.set('comments', comments));
}
this.setState({
@@ -153,7 +153,7 @@ export default class Root extends Component {
// can't save; ignore it
}
api.find({ sort, url })
api.getPostComments({ sort, url })
.then(({ comments } = {}) => store.set('comments', comments))
.finally(() => {
this.setState({ isCommentsListLoading: false });