Newer
Older
* Creates a quotation and header for selected month
* @param date
* @param header
* @param quote
*/
month: date.getMonth(),
year: date.getFullYear(),
header: header,
quote: quote,
},
{
headers: {
'XSRF-TOKEN': token,
},
toast.success('Monthly news succesfully saved !')
/**
* Gets a quotation and header for selected month
*/
year: number,
month: number,
token: string
`/api/admin/monthlyNews/${year}/${month}`,
headers: {
'XSRF-TOKEN': token,
},
return null
}
}
/**
* Gets a poll with question and link for selected month
*/
public getSinglePoll = async (
year: number,
month: number,
token: string
): Promise<IPoll | null> => {
try {
const { data } = await axios.get(
{
headers: {
'XSRF-TOKEN': token,
},
}
)
return data as IPoll
} catch (e) {
console.log('error', e)
return null
}
}
/**
* Creates a poll with question and link for selected month
* @param date
* @param question
* @param link
*/
public createPoll = async (
date: Date,
question: string,
link: string,
token: string
): Promise<void> => {
try {
{
month: date.getMonth(),
year: date.getFullYear(),
link: link,
question: question,
},
{
headers: {
'XSRF-TOKEN': token,
},
}
)
toast.success('Poll successfully saved !')
/**
* Deletes a poll for selected month
* @param month
* @param year
* @param token
*/
public deletePoll = async (
year: number,
month: number,
token: string
): Promise<void> => {
try {
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(
`/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)
}
}