Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue May 14 11:17:45 UTC 2024 - Imobach Gonzalez Sosa <[email protected]>

- Fix DELETE and PATCH calls in the HTTPClient
(gh#openSUSE/agama#1204).

-------------------------------------------------------------------
Mon May 13 09:01:29 UTC 2024 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
4 changes: 2 additions & 2 deletions web/src/client/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class HTTPClient {
* @return {Promise<Response>} Server response.
*/
async delete(url) {
const response = await fetch(`${this.baseUrl}/${url}`, {
const response = await fetch(`${this.baseUrl}${url}`, {
method: "DELETE",
});

Expand All @@ -158,7 +158,7 @@ class HTTPClient {
* @return {Promise<Response>} 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: {
Expand Down
2 changes: 1 addition & 1 deletion web/src/client/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class UsersBaseClient {
* @return {Promise<boolean>} 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;
}

Expand Down
8 changes: 4 additions & 4 deletions web/src/client/users.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand All @@ -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);
});
Expand All @@ -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);
});
Expand Down