From f2386ee9c70a604eec56c0c3af4814449b3d0294 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 14 Jul 2017 01:07:49 +0200 Subject: [PATCH] Improved search --- scripts/AnimeNotifier.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/AnimeNotifier.ts b/scripts/AnimeNotifier.ts index 1bab02e4..54fe10eb 100644 --- a/scripts/AnimeNotifier.ts +++ b/scripts/AnimeNotifier.ts @@ -223,13 +223,19 @@ export class AnimeNotifier { let headers = new Headers() headers.append("X-Reload", "true") - return fetch("/_" + this.app.currentPath, { + let path = this.app.currentPath + + return fetch("/_" + path, { credentials: "same-origin", headers }) .then(response => { + if(this.app.currentPath !== path) { + return Promise.reject("old request") + } + this.app.eTag = response.headers.get("ETag") - return response + return Promise.resolve(response) }) .then(response => response.text()) .then(html => Diff.innerHTML(this.app.content, html))