Use heuristic to guess that we hit a login redirect on saving
This commit is contained in:
parent
2e406f4480
commit
74d2c18943
1 changed files with 6 additions and 2 deletions
|
@ -98,8 +98,12 @@ function openEditor() {
|
|||
credentials: "same-origin",
|
||||
}
|
||||
).then(response => {
|
||||
if ((response.status === 401) && (response.headers.has("location"))) {
|
||||
return loginDialog(response.headers.get("location"))
|
||||
// I don't know how to more precisely determine that we hit a login redirect:
|
||||
const probablyLoginRedirect = response.redirected &&
|
||||
(response.headers.get("content-type") !== "application/json");
|
||||
|
||||
if (probablyLoginRedirect) {
|
||||
return loginDialog(response.url)
|
||||
.then(() => {
|
||||
textarea.disabled = false;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue