Skip to content

Commit

Permalink
fix: add csrf protections to delete repo functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieSlome committed May 1, 2024
1 parent a06f5f1 commit ae88e2e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ui/services/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ const deleteUser = async (user, repoName, action) => {
const deleteRepo = async (repoName) => {
const url = new URL(`${baseUrl}/repo/${repoName}/delete`);

await axios.delete(url, { withCredentials: true }).catch((error) => {
console.log(error.response.data.message);
throw error;
});
await axios
.delete(url, { withCredentials: true, headers: { 'X-CSRF-TOKEN': getCookie('csrf') } })
.catch((error) => {
console.log(error.response.data.message);
throw error;
});
};

export { addUser, deleteUser, getRepos, getRepo, addRepo, deleteRepo };

0 comments on commit ae88e2e

Please sign in to comment.