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 { dispatch, intl } = this.props;
const _onConfirm = () => { const _onConfirm = () => {
addReport(url) addReport('content', url)
.then(() => { .then(() => {
dispatch( dispatch(
toastNotification( toastNotification(

View File

@ -160,12 +160,20 @@ export const deleteBookmark = async (bookmarkId:string) => {
} }
export const addReport = (url) => export const addReport = async (type:'content'|'user', data:string) => {
api try {
const response = await api
.post('/report', { .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;
}
}
/** /**