mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
routes: added range rising
This commit is contained in:
parent
febe619e8c
commit
ddb77e1245
5 changed files with 80 additions and 25 deletions
|
@ -9,7 +9,7 @@ import {
|
|||
postMap
|
||||
} from '$utils/api';
|
||||
import {
|
||||
hideRenderer, searchPutRoutes, searchSetLoading,
|
||||
hideRenderer, searchPutRoutes, searchSetDistance, searchSetLoading,
|
||||
setActiveSticker, setAddress,
|
||||
setChanged, setDialogActive,
|
||||
setEditing,
|
||||
|
@ -437,7 +437,7 @@ function* searchSetSaga() {
|
|||
const { id, token } = yield select(getUser);
|
||||
yield delay(1000);
|
||||
yield put(searchSetLoading(true));
|
||||
const { routes: { filter: { title, distance, tab } } } = yield select(getState);
|
||||
const { routes: { filter, filter: { title, distance, tab } } } = yield select(getState);
|
||||
|
||||
const { list, min, max } = yield call(getRouteList, {
|
||||
id,
|
||||
|
@ -449,6 +449,22 @@ function* searchSetSaga() {
|
|||
});
|
||||
|
||||
yield put(searchPutRoutes({ list, min, max }));
|
||||
|
||||
// change distange range if needed and load additional data
|
||||
if (
|
||||
(filter.min > min && filter.distance[0] <= filter.min) ||
|
||||
(filter.max < max && filter.distance[1] >= filter.max)
|
||||
) {
|
||||
yield put(searchSetDistance([
|
||||
(filter.min > min && filter.distance[0] <= filter.min)
|
||||
? min
|
||||
: filter.distance[0],
|
||||
(filter.max < max && filter.distance[1] >= filter.max)
|
||||
? max
|
||||
: filter.distance[1],
|
||||
]));
|
||||
}
|
||||
|
||||
return yield put(searchSetLoading(false));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue