return render_json_error(
'无法执行置顶操作。',
status: 402
)
使用render_json_error这个方法,怎么样才能在前端弹出错误提示呢?
return render_json_error(
'无法执行置顶操作。',
status: 402
)
使用render_json_error这个方法,怎么样才能在前端弹出错误提示呢?
我不确定完整的上下文是什么,但我认为你可以这样做:
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
try {
// ...
} catch (e) {
popupAjaxError(e);
}
// 或者
ajax("...") // 某个函数
.then(() => {
// ...
})
.catch(popupAjaxError);