return render_json_error(
'Cannot perform the pin operation.',
status: 402
)
Using the render_json_error method, how can I display an error message on the frontend?
return render_json_error(
'Cannot perform the pin operation.',
status: 402
)
Using the render_json_error method, how can I display an error message on the frontend?
Iām not sure what the whole context is, but I believe you can do this:
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
try {
// ...
} catch (e) {
popupAjaxError(e);
}
// OR
ajax("...") // Some function
.then(() => {
// ...
})
.catch(popupAjaxError);