From d56f5a303087f0ad44f23870de4a5fb455997fdb Mon Sep 17 00:00:00 2001
From: ilkin-overleaf <100852799+ilkin-overleaf@users.noreply.github.com>
Date: Mon, 20 May 2024 16:36:22 +0300
Subject: [PATCH] Merge pull request #18424 from
overleaf/ii-delete-with-body-fe
[web] Replace delete with post requests when having body (FE)
GitOrigin-RevId: df727f35ea77eaa8273687f75aafd9bd983b7f25
---
.../js/features/project-list/util/api.ts | 2 +-
.../components/project-list-root.test.tsx | 17 ++++++++++-------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/services/web/frontend/js/features/project-list/util/api.ts b/services/web/frontend/js/features/project-list/util/api.ts
index b2adec39a5..d8f9841e4b 100644
--- a/services/web/frontend/js/features/project-list/util/api.ts
+++ b/services/web/frontend/js/features/project-list/util/api.ts
@@ -42,7 +42,7 @@ export function removeProjectFromTag(tagId: string, projectId: string) {
}
export function removeProjectsFromTag(tagId: string, projectIds: string[]) {
- return deleteJSON(`/tag/${tagId}/projects`, {
+ return postJSON(`/tag/${tagId}/projects/remove`, {
body: {
projectIds,
},
diff --git a/services/web/test/frontend/features/project-list/components/project-list-root.test.tsx b/services/web/test/frontend/features/project-list/components/project-list-root.test.tsx
index eab21bb644..7085c413db 100644
--- a/services/web/test/frontend/features/project-list/components/project-list-root.test.tsx
+++ b/services/web/test/frontend/features/project-list/components/project-list-root.test.tsx
@@ -682,8 +682,8 @@ describe('', function () {
})
it('opens the tags dropdown and remove a tag from selected projects', async function () {
- const deleteProjectsFromTagMock = fetchMock.delete(
- `express:/tag/:id/projects`,
+ const deleteProjectsFromTagMock = fetchMock.post(
+ `express:/tag/:id/projects/remove`,
{
status: 204,
}
@@ -702,11 +702,14 @@ describe('', function () {
await fetchMock.flush(true)
expect(
- deleteProjectsFromTagMock.called(`/tag/${this.tagId}/projects`, {
- body: {
- projectIds: [projectsData[0].id, projectsData[1].id],
- },
- })
+ deleteProjectsFromTagMock.called(
+ `/tag/${this.tagId}/projects/remove`,
+ {
+ body: {
+ projectIds: [projectsData[0].id, projectsData[1].id],
+ },
+ }
+ )
).to.be.true
screen.getByRole('button', { name: `${this.tagName} (0)` })
})