2020-02-03 19:27:42 +03:00
|
|
|
import {helper} from '@ember/component/helper';
|
|
|
|
|
|
|
|
export const DEFAULT_QUERY_PARAMS = {
|
|
|
|
posts: {
|
|
|
|
type: null,
|
2020-06-09 14:19:25 +03:00
|
|
|
visibility: null,
|
2020-02-03 19:27:42 +03:00
|
|
|
author: null,
|
|
|
|
tag: null,
|
|
|
|
order: null
|
2020-02-14 12:34:01 +03:00
|
|
|
},
|
2020-05-22 14:47:03 +03:00
|
|
|
pages: {
|
|
|
|
type: null,
|
2020-06-09 14:19:25 +03:00
|
|
|
visibility: null,
|
2020-05-22 14:47:03 +03:00
|
|
|
author: null,
|
|
|
|
tag: null,
|
|
|
|
order: null
|
|
|
|
},
|
2020-02-14 12:34:01 +03:00
|
|
|
'members.index': {
|
2020-05-28 12:15:17 +03:00
|
|
|
label: null,
|
2020-06-12 14:12:27 +03:00
|
|
|
paid: null,
|
2022-01-05 15:52:00 +03:00
|
|
|
search: null,
|
2021-08-13 17:06:09 +03:00
|
|
|
filter: null,
|
2020-12-08 22:23:57 +03:00
|
|
|
order: null
|
2022-01-17 21:05:10 +03:00
|
|
|
},
|
|
|
|
'members-activity': {
|
2022-01-25 15:13:13 +03:00
|
|
|
excludedEvents: null,
|
|
|
|
member: null
|
2022-08-23 12:37:45 +03:00
|
|
|
},
|
2022-09-06 13:48:45 +03:00
|
|
|
'settings.history': {
|
2022-08-23 12:37:45 +03:00
|
|
|
excludedEvents: null,
|
|
|
|
excludedResources: null,
|
|
|
|
user: null
|
2020-02-03 19:27:42 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// in order to reset query params to their defaults when using <LinkTo> or
|
|
|
|
// `transitionTo` it's necessary to explicitly set each param. This helper makes
|
|
|
|
// it easier to provide a "resetting" link, especially when used with custom views
|
|
|
|
|
|
|
|
export function resetQueryParams(routeName, newParams) {
|
|
|
|
return Object.assign({}, DEFAULT_QUERY_PARAMS[routeName], newParams);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default helper(function (params/*, hash*/) {
|
|
|
|
return resetQueryParams(...params);
|
|
|
|
});
|