1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Refactor ConnectionState to a shared enum

This commit is contained in:
Bill Thornton 2022-10-21 15:05:50 -04:00
parent f3dda2e783
commit 7e9bf96668
6 changed files with 39 additions and 25 deletions

View file

@ -19,6 +19,7 @@ import Dashboard from '../../../utils/dashboard';
import ServerConnections from '../../../components/ServerConnections';
import alert from '../../../components/alert';
import cardBuilder from '../../../components/cardbuilder/cardBuilder';
import { ConnectionState } from '../../../utils/jellyfin-apiclient/ConnectionState.ts';
/* eslint-disable indent */
@ -113,17 +114,17 @@ import cardBuilder from '../../../components/cardbuilder/cardBuilder';
const apiClient = result.ApiClient;
switch (result.State) {
case 'SignedIn':
case ConnectionState.SignedIn:
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
Dashboard.navigate('home.html');
break;
case 'ServerSignIn':
case ConnectionState.ServerSignIn:
Dashboard.onServerChanged(null, null, apiClient);
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id);
break;
case 'ServerUpdateNeeded':
case ConnectionState.ServerUpdateNeeded:
alertTextWithOptions({
text: globalize.translate('core#ServerUpdateNeeded', 'https://github.com/jellyfin/jellyfin'),
html: globalize.translate('core#ServerUpdateNeeded', '<a href="https://github.com/jellyfin/jellyfin">https://github.com/jellyfin/jellyfin</a>')