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'; ...@@ -6,7 +6,7 @@ import { DEFAULT_PER_PAGE } from '~/api';
import { fetchOverrides } from '~/integrations/overrides/api'; import { fetchOverrides } from '~/integrations/overrides/api';
import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils'; import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils';
import { truncateNamespace } from '~/lib/utils/text_utility'; 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 { __, s__ } from '~/locale';
import ProjectAvatar from '~/vue_shared/components/project_avatar.vue'; import ProjectAvatar from '~/vue_shared/components/project_avatar.vue';
import UrlSync from '~/vue_shared/components/url_sync.vue'; import UrlSync from '~/vue_shared/components/url_sync.vue';
...@@ -61,8 +61,7 @@ export default { ...@@ -61,8 +61,7 @@ export default {
}, },
methods: { methods: {
getInitialPage() { getInitialPage() {
const { page } = queryToObject(window.location.search); return getParameterByName('page') ?? DEFAULT_PAGE;
return page ?? DEFAULT_PAGE;
}, },
loadOverrides(page) { loadOverrides(page) {
this.isLoading = true; this.isLoading = true;
......
...@@ -171,13 +171,13 @@ describe('IntegrationOverrides', () => { ...@@ -171,13 +171,13 @@ describe('IntegrationOverrides', () => {
await findPagination().vm.$emit('input', mockPage); 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, { expect(axios.get).toHaveBeenCalledWith(defaultProps.overridesPath, {
params: { page: mockPage, per_page: DEFAULT_PER_PAGE }, 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}`); 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