🎨 Display error message if it happens
This commit is contained in:
parent
874be054fe
commit
394f4af8c8
@ -30,12 +30,12 @@ ext.runtime.onMessage.addListener(
|
||||
body: new URLSearchParams(queryString)
|
||||
})
|
||||
.then(function(response) {
|
||||
if (200 === response.status) {
|
||||
sendResponse({action: "saved"});
|
||||
} else {
|
||||
sendResponse({action: "error", status: response.status, error: response.statusText});
|
||||
}
|
||||
});
|
||||
// var destination = url+"?v=1&u="+encodeURIComponent(data.url)+"&t="+encodeURIComponent(data.title)+"&m="+encodeURIComponent(token);
|
||||
// fetch(destination).then(function(response) {
|
||||
// sendResponse({ action: "saved" });
|
||||
// });
|
||||
});
|
||||
|
||||
return true; // https://stackoverflow.com/a/20077854
|
||||
|
@ -62,7 +62,7 @@ popup.addEventListener("click", function(e) {
|
||||
if (response && response.action === "saved") {
|
||||
renderMessage(ext.i18n.getMessage("savedSuccessfully"));
|
||||
} else {
|
||||
renderMessage(ext.i18n.getMessage("unknownError"));
|
||||
renderMessage(response.error + " ("+response.status+")");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user