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);