diff --git a/frontend/app.js b/frontend/app.js index a90db2d..0734fcd 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -150,9 +150,7 @@ createApp({ this.users = []; this.status = ''; this.error = ''; - this.view = 'byAud'; - // опционально: редирект на страницу логина - // window.location.href = '/login'; + window.location.href = '/login'; }, authHeaders() { const h = {}; @@ -162,6 +160,10 @@ createApp({ async fetchAuth(url, options = {}) { const opt = { ...options, headers: { ...(options.headers||{}), ...this.authHeaders() } }; const res = await fetch(url, opt); + if (res.status === 401) { + this.logout(); + return; + } if (!res.ok) { const text = await res.text(); throw new Error(`HTTP ${res.status}: ${text}`);