diff --git a/training-front-end/src/components/AdminSearchUser.vue b/training-front-end/src/components/AdminSearchUser.vue index b0cce769..afbbe065 100644 --- a/training-front-end/src/components/AdminSearchUser.vue +++ b/training-front-end/src/components/AdminSearchUser.vue @@ -33,8 +33,9 @@ async function search() { noResults.value = false - const url = new URL(`${report_url}${searchTerm.value}`) - url.search = new URLSearchParams({page_number: currentPage.value + 1}) + const url = new URL(`${report_url}`) + url.search = new URLSearchParams({name: searchTerm.value, page_number: currentPage.value + 1}) + try { const response = await fetch( url, { @@ -64,7 +65,7 @@ try { const response = await fetch( url, { - method: "PUT", + method: "PATCH", headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${user.value.jwt}` diff --git a/training-front-end/src/components/__tests__/AdminSearchUser.spec.js b/training-front-end/src/components/__tests__/AdminSearchUser.spec.js index f09ee473..13a76abf 100644 --- a/training-front-end/src/components/__tests__/AdminSearchUser.spec.js +++ b/training-front-end/src/components/__tests__/AdminSearchUser.spec.js @@ -69,7 +69,7 @@ describe('AdminAgencySelect', async () => { expect(updateFetchSpy).nthCalledWith(1, expect.any(URL), { body: '[10]', - method: 'PUT', + method: 'PATCH', headers: { 'Authorization': 'Bearer some-token-value', 'Content-Type': 'application/json' @@ -118,7 +118,7 @@ describe('AdminAgencySelect', async () => { linkElements[1].trigger('click') expect(fetchSpy).toBeCalledTimes(2) - expect(fetchSpy.mock.lastCall[0].search).toBe('?page_number=2') + expect(fetchSpy.mock.lastCall[0].search).toBe('?name=Steeply&page_number=2') }) it('displays no results message', async () => {