Commit 8089a2fe authored by Tom Quirk's avatar Tom Quirk

Address maintainer feedback

- use getParameterByName
- remove redundant `async` declarations
parent 2e32932e
......@@ -6,7 +6,7 @@ import { DEFAULT_PER_PAGE } from '~/api';
import { fetchOverrides } from '~/integrations/overrides/api';
import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils';
import { truncateNamespace } from '~/lib/utils/text_utility';
import { queryToObject } from '~/lib/utils/url_utility';
import { getParameterByName } from '~/lib/utils/url_utility';
import { __, s__ } from '~/locale';
import ProjectAvatar from '~/vue_shared/components/project_avatar.vue';
import UrlSync from '~/vue_shared/components/url_sync.vue';
......@@ -61,8 +61,7 @@ export default {
},
methods: {
getInitialPage() {
const { page } = queryToObject(window.location.search);
return page ?? DEFAULT_PAGE;
return getParameterByName('page') ?? DEFAULT_PAGE;
},
loadOverrides(page) {
this.isLoading = true;
......
......@@ -171,13 +171,13 @@ describe('IntegrationOverrides', () => {
await findPagination().vm.$emit('input', mockPage);
});
it('performs GET request with correct params', async () => {
it('performs GET request with correct params', () => {
expect(axios.get).toHaveBeenCalledWith(defaultProps.overridesPath, {
params: { page: mockPage, per_page: DEFAULT_PER_PAGE },
});
});
it('updates `page` URL parameter', async () => {
it('updates `page` URL parameter', () => {
expect(window.location.search).toBe(`?page=${mockPage}`);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment