From 9de91afec8f23e75567a5a37a5f8e0c09d265730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Tue, 14 May 2024 12:15:11 +0100 Subject: [PATCH 1/3] web: fix PATCH and DELETE URLs --- web/src/client/http.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/client/http.js b/web/src/client/http.js index fda36be371..37a4ebdbef 100644 --- a/web/src/client/http.js +++ b/web/src/client/http.js @@ -145,7 +145,7 @@ class HTTPClient { * @return {Promise} Server response. */ async delete(url) { - const response = await fetch(`${this.baseUrl}/${url}`, { + const response = await fetch(`${this.baseUrl}${url}`, { method: "DELETE", }); @@ -158,7 +158,7 @@ class HTTPClient { * @return {Promise} Server response. */ async patch(url, data) { - const response = await fetch(`${this.baseUrl}/${url}`, { + const response = await fetch(`${this.baseUrl}${url}`, { method: "PATCH", body: JSON.stringify(data), headers: { From 15e141afd17218ad5a4c04ad03b806cec61cd797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Tue, 14 May 2024 12:15:29 +0100 Subject: [PATCH 2/3] web: fix setRootPassword call --- web/src/client/users.js | 2 +- web/src/client/users.test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/src/client/users.js b/web/src/client/users.js index a62663ba7f..b93c154652 100644 --- a/web/src/client/users.js +++ b/web/src/client/users.js @@ -115,7 +115,7 @@ class UsersBaseClient { * @return {Promise} whether the operation was successful or not */ async setRootPassword(password) { - const response = await this.client.patch("/users/root", { password, password_encrypted: false }); + const response = await this.client.patch("/users/root", { password, passwordEncrypted: false }); return response.ok; } diff --git a/web/src/client/users.test.js b/web/src/client/users.test.js index 31929d351e..405d797b81 100644 --- a/web/src/client/users.test.js +++ b/web/src/client/users.test.js @@ -169,7 +169,7 @@ describe("#setRootPassword", () => { const result = await client.setRootPassword("12345"); expect(mockPatchFn).toHaveBeenCalledWith("/users/root", { password: "12345", - password_encrypted: false, + passwordEncrypted: false, }); expect(result).toEqual(true); }); @@ -183,7 +183,7 @@ describe("#setRootPassword", () => { const result = await client.setRootPassword("12345"); expect(mockPatchFn).toHaveBeenCalledWith("/users/root", { password: "12345", - password_encrypted: false, + passwordEncrypted: false, }); expect(result).toEqual(false); }); @@ -199,7 +199,7 @@ describe("#removeRootPassword", () => { const result = await client.removeRootPassword(); expect(mockPatchFn).toHaveBeenCalledWith("/users/root", { password: "", - password_encrypted: false, + passwordEncrypted: false, }); expect(result).toEqual(true); }); @@ -213,7 +213,7 @@ describe("#removeRootPassword", () => { const result = await client.removeRootPassword(); expect(mockPatchFn).toHaveBeenCalledWith("/users/root", { password: "", - password_encrypted: false, + passwordEncrypted: false, }); expect(result).toEqual(false); }); From 95b1c47787bcd464c34207399be7f4a4443f345c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Tue, 14 May 2024 12:20:13 +0100 Subject: [PATCH 3/3] web: update the changes file --- web/package/agama-web-ui.changes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/package/agama-web-ui.changes b/web/package/agama-web-ui.changes index f8e1c87bfc..763dff48f7 100644 --- a/web/package/agama-web-ui.changes +++ b/web/package/agama-web-ui.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 14 11:17:45 UTC 2024 - Imobach Gonzalez Sosa + +- Fix DELETE and PATCH calls in the HTTPClient + (gh#openSUSE/agama#1204). + ------------------------------------------------------------------- Mon May 13 09:01:29 UTC 2024 - Imobach Gonzalez Sosa