Improved search

This commit is contained in:
Eduard Urbach 2017-07-14 01:07:49 +02:00
parent b165e117bb
commit f2386ee9c7

View File

@ -223,13 +223,19 @@ export class AnimeNotifier {
let headers = new Headers() let headers = new Headers()
headers.append("X-Reload", "true") headers.append("X-Reload", "true")
return fetch("/_" + this.app.currentPath, { let path = this.app.currentPath
return fetch("/_" + path, {
credentials: "same-origin", credentials: "same-origin",
headers headers
}) })
.then(response => { .then(response => {
if(this.app.currentPath !== path) {
return Promise.reject("old request")
}
this.app.eTag = response.headers.get("ETag") this.app.eTag = response.headers.get("ETag")
return response return Promise.resolve(response)
}) })
.then(response => response.text()) .then(response => response.text())
.then(html => Diff.innerHTML(this.app.content, html)) .then(html => Diff.innerHTML(this.app.content, html))