Ghost/ghost/admin/app/helpers/reset-query-params.js
Daniel Lockyer b226b03f09
Renamed Audit Log to History
refs https://github.com/TryGhost/Toolbox/issues/356

- this commit updates the route to `/settings/history` and moves all the
  files to their new name so we can avoid further cleanup down the line
2022-09-06 11:49:29 +01:00

47 lines
1.1 KiB
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: null,
filter: null,
order: null
},
'members-activity': {
excludedEvents: null,
member: null
},
'settings.history': {
excludedEvents: null,
excludedResources: null,
user: null
}
};
// 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);
});