#find @method -rename
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user