+ fetch(url, {
+ method: method,
+ headers: { ...OSM.oauth },
+ body: data
+ })
+ .then(response => {
+ if (response.ok) return response;
+ return response.text().then(text => {
+ throw new Error(text);
+ });
+ })
+ .then(() => {
+ OSM.loadSidebarContent(location.pathname, page.load);
+ })
+ .catch(error => {
+ content.find("button[data-method][data-url]").prop("disabled", false);
+ content.find("#comment-error")
+ .text(error.message)
+ .prop("hidden", false)
+ .get(0).scrollIntoView({ block: "nearest" });
+ });