updated addReport method to support report type

This commit is contained in:
Nouman Tahir 2021-10-01 21:40:59 +05:00
parent cd7780113e
commit 73f724746b
2 changed files with 13 additions and 5 deletions

View File

@ -124,7 +124,7 @@ class PostDropdownContainer extends PureComponent {
const { dispatch, intl } = this.props;
const _onConfirm = () => {
addReport(url)
addReport('content', url)
.then(() => {
dispatch(
toastNotification(

View File

@ -160,12 +160,20 @@ export const deleteBookmark = async (bookmarkId:string) => {
}
export const addReport = (url) =>
api
export const addReport = async (type:'content'|'user', data:string) => {
try {
const response = await api
.post('/report', {
url,
type,
data
})
.then((resp) => resp.data);
return response.data
} catch(err){
console.warn("Failed to report to ecency")
bugsnagInstance.notify(err);
throw err;
}
}
/**