web: People: Fixed set filter by url
This commit is contained in:
parent
d6c4171a82
commit
1b293c6112
@ -12,18 +12,6 @@ import {
|
||||
department
|
||||
} from "./../../../../../helpers/customNames";
|
||||
import { withRouter } from "react-router";
|
||||
import Filter from "../../../../../store/people/filter";
|
||||
import {
|
||||
EMPLOYEE_STATUS,
|
||||
ACTIVATION_STATUS,
|
||||
ROLE,
|
||||
GROUP,
|
||||
SEARCH,
|
||||
SORT_BY,
|
||||
SORT_ORDER,
|
||||
PAGE,
|
||||
PAGE_COUNT
|
||||
} from "../../../../../helpers/constants";
|
||||
import { getFilterByLocation } from "../../../../../helpers/converters";
|
||||
|
||||
const getEmployeeStatus = filterValues => {
|
||||
|
@ -2,6 +2,7 @@ import * as api from "../services/api";
|
||||
import { setGroups, fetchPeopleAsync } from "../people/actions";
|
||||
import setAuthorizationToken from "../../store/services/setAuthorizationToken";
|
||||
import { getFilterByLocation } from "../../helpers/converters";
|
||||
import config from "../../../package.json";
|
||||
|
||||
export const LOGIN_POST = "LOGIN_POST";
|
||||
export const SET_CURRENT_USER = "SET_CURRENT_USER";
|
||||
@ -60,9 +61,14 @@ export async function getUserInfo(dispatch) {
|
||||
|
||||
dispatch(setGroups(groupResp.data.response));
|
||||
|
||||
const newFilter = getFilterByLocation(window.location);
|
||||
var re = new RegExp(`${config.homepage}((/?)$|/filter)`, "gm");
|
||||
const match = window.location.pathname.match(re);
|
||||
|
||||
await fetchPeopleAsync(dispatch, newFilter);
|
||||
if (match && match.length > 0)
|
||||
{
|
||||
const newFilter = getFilterByLocation(window.location);
|
||||
await fetchPeopleAsync(dispatch, newFilter);
|
||||
}
|
||||
|
||||
return dispatch(setIsLoaded(true));
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ export function deselectUser(user) {
|
||||
};
|
||||
}
|
||||
|
||||
export function setFilter(filter) {
|
||||
export function setFilterUrl(filter) {
|
||||
const defaultFilter = Filter.getDefault();
|
||||
const params = [];
|
||||
|
||||
@ -121,6 +121,10 @@ export function setFilter(filter) {
|
||||
if (params.length > 0) {
|
||||
history.push(`${config.homepage}/filter?${params.join("&")}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function setFilter(filter) {
|
||||
setFilterUrl(filter);
|
||||
return {
|
||||
type: SET_FILTER,
|
||||
filter
|
||||
|
Loading…
Reference in New Issue
Block a user