//native
type Phrase = {
token: string
baseUrl: string
}
/**
* Mark all notifications as read
* Mark all notifications of the current user as read
*/
export async function main(auth: Phrase) {
const url = new URL(`${auth.baseUrl}/notifications/mark_all_as_read`)
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'ApiToken ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago