Merge pull request #18424 from overleaf/ii-delete-with-body-fe

[web] Replace delete with post requests when having body (FE)

GitOrigin-RevId: df727f35ea77eaa8273687f75aafd9bd983b7f25
This commit is contained in:
ilkin-overleaf 2024-05-20 16:36:22 +03:00 committed by Copybot
parent 7ca9a5b61b
commit d56f5a3030
2 changed files with 11 additions and 8 deletions

View file

@ -42,7 +42,7 @@ export function removeProjectFromTag(tagId: string, projectId: string) {
} }
export function removeProjectsFromTag(tagId: string, projectIds: string[]) { export function removeProjectsFromTag(tagId: string, projectIds: string[]) {
return deleteJSON(`/tag/${tagId}/projects`, { return postJSON(`/tag/${tagId}/projects/remove`, {
body: { body: {
projectIds, projectIds,
}, },

View file

@ -682,8 +682,8 @@ describe('<ProjectListRoot />', function () {
}) })
it('opens the tags dropdown and remove a tag from selected projects', async function () { it('opens the tags dropdown and remove a tag from selected projects', async function () {
const deleteProjectsFromTagMock = fetchMock.delete( const deleteProjectsFromTagMock = fetchMock.post(
`express:/tag/:id/projects`, `express:/tag/:id/projects/remove`,
{ {
status: 204, status: 204,
} }
@ -702,11 +702,14 @@ describe('<ProjectListRoot />', function () {
await fetchMock.flush(true) await fetchMock.flush(true)
expect( expect(
deleteProjectsFromTagMock.called(`/tag/${this.tagId}/projects`, { deleteProjectsFromTagMock.called(
body: { `/tag/${this.tagId}/projects/remove`,
projectIds: [projectsData[0].id, projectsData[1].id], {
}, body: {
}) projectIds: [projectsData[0].id, projectsData[1].id],
},
}
)
).to.be.true ).to.be.true
screen.getByRole('button', { name: `${this.tagName} (0)` }) screen.getByRole('button', { name: `${this.tagName} (0)` })
}) })