Ghost/ghost/admin/app/helpers/reset-query-params.js
Kevin Ansfield 16f4b1c9af Added all/free/paid filter to members admin screen (#1600)
requires https://github.com/TryGhost/Ghost/pull/11892

- adds `?paid` query parameter to members route that is tied to the `?paid` query param in the API request
- added all/free/paid members dropdown to members filter component
2020-06-12 12:12:27 +01:00

36 lines
904 B
JavaScript

import {helper} from '@ember/component/helper';
export const DEFAULT_QUERY_PARAMS = {
posts: {
type: null,
visibility: null,
author: null,
tag: null,
order: null
},
pages: {
type: null,
visibility: null,
author: null,
tag: null,
order: null
},
'members.index': {
label: null,
paid: null,
search: ''
}
};
// 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);
});