举报时手动选择是否隐藏
This commit is contained in:
@@ -550,8 +550,9 @@ class FlowSidebar extends PureComponent {
|
|||||||
report(event, text = '') {
|
report(event, text = '') {
|
||||||
console.log(text);
|
console.log(text);
|
||||||
let reason = prompt(`举报 #${this.state.info.pid} 的理由:`, text);
|
let reason = prompt(`举报 #${this.state.info.pid} 的理由:`, text);
|
||||||
|
let should_hide = confirm('是否认为此洞应该被删除或隐藏?');
|
||||||
if (reason !== null) {
|
if (reason !== null) {
|
||||||
API.report(this.state.info.pid, reason, this.props.token)
|
API.report(this.state.info.pid, reason, should_hide, this.props.token)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
alert('举报成功');
|
alert('举报成功');
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -80,10 +80,14 @@ export const API = {
|
|||||||
return handle_response(response, false);
|
return handle_response(response, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
report: async (pid, reason, token) => {
|
report: async (pid, reason, should_hide, token) => {
|
||||||
let data = new URLSearchParams();
|
let data = new URLSearchParams([
|
||||||
data.append('pid', pid);
|
['pid', pid],
|
||||||
data.append('reason', reason);
|
['reason', reason],
|
||||||
|
]);
|
||||||
|
if (should_hide) {
|
||||||
|
data.append('should_hide', 1);
|
||||||
|
}
|
||||||
let response = await fetch(API_BASE + '/report', {
|
let response = await fetch(API_BASE + '/report', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user