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",
|
credentials: "same-origin",
|
||||||
}
|
}
|
||||||
).then(response => {
|
).then(response => {
|
||||||
if ((response.status === 401) && (response.headers.has("location"))) {
|
// I don't know how to more precisely determine that we hit a login redirect:
|
||||||
return loginDialog(response.headers.get("location"))
|
const probablyLoginRedirect = response.redirected &&
|
||||||
|
(response.headers.get("content-type") !== "application/json");
|
||||||
|
|
||||||
|
if (probablyLoginRedirect) {
|
||||||
|
return loginDialog(response.url)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
textarea.disabled = false;
|
textarea.disabled = false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue