refactor: ServerState type

This commit is contained in:
Zack Spear
2023-07-07 15:40:55 -07:00
parent a775026bf5
commit 706c71df10
2 changed files with 28 additions and 23 deletions

View File

@@ -52,7 +52,7 @@ export const useServerStore = defineStore('server', () => {
const regGen = ref<number>(0);
const regGuid = ref<string>('');
const site = ref<string>('');
const state = ref<string>(''); // @todo implement ServerState ENUM
const state = ref<ServerState>();
const theme = ref<Theme>();
const uptime = ref<number>(0);
const username = ref<string>(''); // @todo potentially move to a user store

View File

@@ -2,24 +2,30 @@ import { KeyIcon } from '@heroicons/vue/24/solid';
import { Theme } from '~/store/theme';
import { UserProfileLink } from '~/types/userProfile';
export enum ServerState {
BASIC = 'BASIC',
PLUS = 'PLUS',
PRO = 'PRO',
TRIAL = 'TRIAL',
EEXPIRED = 'EEXPIRED',
ENOKEYFILE = 'ENOKEYFILE',
EGUID = 'EGUID',
EGUID1 = 'EGUID1',
ETRIAL = 'ETRIAL',
ENOKEYFILE2 = 'ENOKEYFILE2',
ENOKEYFILE1 = 'ENOKEYFILE1',
ENOFLASH = 'ENOFLASH',
EBLACKLISTED = 'EBLACKLISTED',
EBLACKLISTED1 = 'EBLACKLISTED1',
EBLACKLISTED2 = 'EBLACKLISTED2',
ENOCONN = 'ENOCONN',
}
export type ServerState = 'BASIC'
| 'PLUS'
| 'PRO'
| 'TRIAL'
| 'EEXPIRED'
| 'ENOKEYFILE'
| 'EGUID'
| 'EGUID1'
| 'ETRIAL'
| 'ENOKEYFILE2'
| 'ENOKEYFILE1'
| 'ENOFLASH'
| 'ENOFLASH1'
| 'ENOFLASH2'
| 'ENOFLASH3'
| 'ENOFLASH4'
| 'ENOFLASH5'
| 'ENOFLASH6'
| 'ENOFLASH7'
| 'EBLACKLISTED'
| 'EBLACKLISTED1'
| 'EBLACKLISTED2'
| 'ENOCONN'
| undefined;
export interface Server {
apiKey?: string;
avatar?: string;
@@ -42,8 +48,7 @@ export interface Server {
regGen?: number;
regGuid?: string;
site?: string;
// state?: ServerState;
state: string;
state?: ServerState;
theme: Theme;
uptime?: number;
username?: string;
@@ -67,7 +72,7 @@ export interface ServerAccountCallbackSendPayload {
regGen?: number;
regGuid?: string;
site?: string;
state: string;
state: ServerState;
wanFQDN?: string;
}
@@ -81,7 +86,7 @@ export interface ServerPurchaseCallbackSendPayload {
keyTypeForPurchase: ServerKeyTypeForPurchase;
locale: string;
registered: boolean;
state: string;
state: ServerState;
site: string;
}