feat: Authenticated Shell, Quick Tabs and Change Password 1.05
This commit is contained in:
@@ -48,6 +48,11 @@ export class AuthenticatedEventSourceService {
|
||||
dispatch('error', new Event('error'));
|
||||
};
|
||||
|
||||
const fireUnauthorized = () => {
|
||||
if (closed) return;
|
||||
dispatch('unauthorized', new Event('unauthorized'));
|
||||
};
|
||||
|
||||
const start = async () => {
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
@@ -56,6 +61,10 @@ export class AuthenticatedEventSourceService {
|
||||
credentials: 'include',
|
||||
signal: controller!.signal,
|
||||
});
|
||||
if (res.status === 401 || res.status === 403) {
|
||||
if (!closed) fireUnauthorized();
|
||||
return;
|
||||
}
|
||||
if (!res.ok || !res.body) {
|
||||
fireError();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user