Fix search expand when searching user' posts
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
02479efc35
commit
2829a0097a
1 changed files with 12 additions and 7 deletions
|
@ -119,17 +119,22 @@ const setFilter = (filterType: SearchFilter) =>
|
||||||
};
|
};
|
||||||
|
|
||||||
const expandSearch = (type: SearchFilter) => (dispatch: AppDispatch, getState: () => RootState) => {
|
const expandSearch = (type: SearchFilter) => (dispatch: AppDispatch, getState: () => RootState) => {
|
||||||
const value = getState().search.value;
|
const value = getState().search.value;
|
||||||
const offset = getState().search.results[type].size;
|
const offset = getState().search.results[type].size;
|
||||||
|
const accountId = getState().search.accountId;
|
||||||
|
|
||||||
dispatch(expandSearchRequest(type));
|
dispatch(expandSearchRequest(type));
|
||||||
|
|
||||||
|
const params: Record<string, any> = {
|
||||||
|
q: value,
|
||||||
|
type,
|
||||||
|
offset,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (accountId) params.account_id = accountId;
|
||||||
|
|
||||||
api(getState).get('/api/v2/search', {
|
api(getState).get('/api/v2/search', {
|
||||||
params: {
|
params,
|
||||||
q: value,
|
|
||||||
type,
|
|
||||||
offset,
|
|
||||||
},
|
|
||||||
}).then(({ data }) => {
|
}).then(({ data }) => {
|
||||||
if (data.accounts) {
|
if (data.accounts) {
|
||||||
dispatch(importFetchedAccounts(data.accounts));
|
dispatch(importFetchedAccounts(data.accounts));
|
||||||
|
|
Loading…
Reference in a new issue