Skip to content
Snippets Groups Projects
Commit 254b4b0e authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Add deletion service

parent 7d7af586
No related branches found
No related tags found
2 merge requests!7feat: add front office,!2Feat/setup auth
...@@ -130,4 +130,53 @@ export class MonthlyNewsService { ...@@ -130,4 +130,53 @@ export class MonthlyNewsService {
console.log(e) console.log(e)
} }
} }
/**
* Deletes a poll for selected month
* @param month
* @param year
* @param token
*/
public deletePoll = async (
year: number,
month: number,
token: string
): Promise<void> => {
try {
await axios.delete(`${this._apiUrl}api/admin/poll/${year}/${month}`, {
headers: {
'XSRF-TOKEN': token,
},
})
toast.success('Poll succesfully deleted !')
} catch (e) {
toast.error('Failed to delete poll')
console.log(e)
}
}
/**
* Deletes a Monthly News for selected month
* @param year
* @param month
* @param token
*/
public deleteMonthlyNews = async (
year: number,
month: number,
token: string
): Promise<void> => {
try {
await axios.delete(
`${this._apiUrl}api/admin/monthlyNews/${year}/${month}`,
{
headers: {
'XSRF-TOKEN': token,
},
}
)
toast.success('Monthly news succesfully deleted !')
} catch (e) {
toast.error('Failed to delete monthly news')
console.log(e)
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment