From 670a287c7f9183aa1ea83270598feb46b2fb1ed3 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sun, 2 Oct 2022 17:04:11 +0200 Subject: [PATCH] Implements reload on 401 response as suggested in #43 --- repos-plugins/browsedetails/browsedetails.plugin.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repos-plugins/browsedetails/browsedetails.plugin.js b/repos-plugins/browsedetails/browsedetails.plugin.js index 922c4f75..99fbfd7d 100644 --- a/repos-plugins/browsedetails/browsedetails.plugin.js +++ b/repos-plugins/browsedetails/browsedetails.plugin.js @@ -1,6 +1,8 @@ (function($){ +const RELOAD_401_DELAY_MS = 100; + /** * Activates the possibility to load an embedded details page for repos target (file and folder link) elements. */ @@ -14,6 +16,9 @@ $.fn.reposDetailsTarget = function(options) { error: function(req) { if (!req.status) { // probably aborted because of page leave window.logger && logger.info('details load interrupted with status', req.status); + } else if (req.status === 401) { + console.log('Response 401 triggers page reload as of https://github.com/Reposoft/rweb/issues/43', req); + setTimeout(() => window.location.reload(), RELOAD_401_DELAY_MS); } else { alert('Details load error ' + (typeof req == 'undefined' ? '' : req.status));