From 6539c58c7fa898a134c4f47d4a05d0fcbae0fcf0 Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Tue, 29 Aug 2023 15:24:10 -0700 Subject: [PATCH] chore(web): remove console debugs --- .../plugins/dynamix.my.servers/Connect.page | 1 - web/components/I18nHost.ce.vue | 2 -- web/components/UserProfile/Trial.vue | 4 ++- web/components/WanIpCheck.ce.vue | 2 -- web/composables/installPlugin.ts | 4 --- web/composables/services/webgui.ts | 6 ++-- web/store/account.ts | 11 ------ web/store/callbackActions.ts | 6 ---- web/store/dropdown.ts | 1 - web/store/errors.ts | 8 ----- web/store/installKey.ts | 5 --- web/store/purchase.ts | 3 -- web/store/server.ts | 34 ------------------- web/store/theme.ts | 1 - web/store/trial.ts | 6 +--- web/store/unraidApi.ts | 20 +++-------- 16 files changed, 11 insertions(+), 103 deletions(-) diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page index ed59c8702..00799fa8d 100644 --- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page @@ -156,7 +156,6 @@ function registerServer(button) { "api_extraOrigins": validateExtraOrigins(), }; - // console.debug(JSON.stringify(postobj,null,2)) $(button).prop("disabled", true).html("_(Applying)_ "); $.post('/webGui/include/Dispatcher.php', postobj, function(data2) { diff --git a/web/components/I18nHost.ce.vue b/web/components/I18nHost.ce.vue index 847f9ffaa..3690d6f95 100644 --- a/web/components/I18nHost.ce.vue +++ b/web/components/I18nHost.ce.vue @@ -19,12 +19,10 @@ let nonDefaultLocale = false; */ const windowLocaleData = (window as any).LOCALE_DATA || null; if (windowLocaleData) { - console.debug('[I18nHost] parsing messages'); try { parsedMessages = JSON.parse(decodeURIComponent(windowLocaleData)); parsedLocale = Object.keys(parsedMessages)[0]; nonDefaultLocale = parsedLocale !== defaultLocale; - console.debug('[I18nHost] messages parsed. Now setting up vue-i18n', nonDefaultLocale, parsedLocale, parsedMessages); } catch (error) { console.error('[I18nHost] error parsing messages', error); } diff --git a/web/components/UserProfile/Trial.vue b/web/components/UserProfile/Trial.vue index 1e109d4a6..2b2902782 100644 --- a/web/components/UserProfile/Trial.vue +++ b/web/components/UserProfile/Trial.vue @@ -46,7 +46,9 @@ const trialStatusCopy = computed((): TrialStatusCopy | null => { }); const close = () => { - if (trialStatus.value === 'trialStart') { return console.debug('[close] not allowed'); } + if (trialStatus.value === 'trialStart') { + return; + } trialStore.setTrialStatus('ready'); }; diff --git a/web/components/WanIpCheck.ce.vue b/web/components/WanIpCheck.ce.vue index 48050c37a..b69d186ea 100644 --- a/web/components/WanIpCheck.ce.vue +++ b/web/components/WanIpCheck.ce.vue @@ -33,7 +33,6 @@ onBeforeMount(() => { watchEffect(async () => { // if we don't have a client WAN IP AND we have the server WAN IP then we fetch if (!wanIp.value && props.phpWanIp) { - console.debug('[watch] wanIp'); loading.value = true; const response = await request.url('https://wanip4.unraid.net/') @@ -41,7 +40,6 @@ watchEffect(async () => { .text(); if (response) { - console.debug('[watch] wanIp response', response); loading.value = false; wanIp.value = response as string; // response returns text nothing to traverse // save in sessionStorage so we only make this request once per webGUI session diff --git a/web/composables/installPlugin.ts b/web/composables/installPlugin.ts index 1db521fb1..604720037 100644 --- a/web/composables/installPlugin.ts +++ b/web/composables/installPlugin.ts @@ -1,9 +1,7 @@ const useInstallPlugin = () => { const install = (payload = { staging: false, update: false }) => { - console.debug('[useInstallPlugin.install]', { payload }); try { const file = `https://sfo2.digitaloceanspaces.com/unraid-dl/unraid-api/dynamix.unraid.net${payload?.staging ? '.staging.plg' : '.plg'}`; - console.debug('[useInstallPlugin.install]', file); if (!payload.update) { // after initial install, the dropdown store looks for this to automatically open the launchpad dropdown @@ -13,7 +11,6 @@ const useInstallPlugin = () => { // @ts-ignore – `openPlugin` will be included in 6.10.4+ DefaultPageLayout if (typeof openPlugin === 'function') { - console.debug('[useInstallPlugin.install] using openPlugin', file); // @ts-ignore openPlugin( @@ -23,7 +20,6 @@ const useInstallPlugin = () => { 'refresh', ); } else { - console.debug('[useInstallPlugin.install] using openBox', file); // `openBox()` is defined in the webgui's DefaultPageLayout.php and used when openPlugin is not available // @ts-ignore diff --git a/web/composables/services/webgui.ts b/web/composables/services/webgui.ts index dfe4f0f93..149d0b629 100644 --- a/web/composables/services/webgui.ts +++ b/web/composables/services/webgui.ts @@ -44,7 +44,6 @@ export interface WebguiUnraidApiCommandPayload { param1?: '-v'|'-vv'; } export const WebguiUnraidApiCommand = async (payload: WebguiUnraidApiCommandPayload) => { - console.debug('[WebguiUnraidApiCommand]', payload); if (!payload) { return console.error('[WebguiUnraidApiCommand] payload is required'); } try { @@ -53,13 +52,12 @@ export const WebguiUnraidApiCommand = async (payload: WebguiUnraidApiCommandPayl .formUrl(payload) .post() .json((json) => { - console.debug('[WebguiUnraidApiCommand]', json); return json; }) .catch((error) => { - console.error(`[WebguiUnraidApiCommand] catch failed to execute unraid-api ${command}`, error); + console.error(`[WebguiUnraidApiCommand] catch failed to execute unraid-api ${payload}`, error); }); } catch (error) { - console.error(`[WebguiUnraidApiCommand] catch failed to execute unraid-api ${command}`, error); + console.error(`[WebguiUnraidApiCommand] catch failed to execute unraid-api ${payload}`, error); } }; diff --git a/web/store/account.ts b/web/store/account.ts index 527f91583..b21475e47 100644 --- a/web/store/account.ts +++ b/web/store/account.ts @@ -29,7 +29,6 @@ export const useAccountStore = defineStore('account', () => { // Actions const recover = () => { - console.debug('[accountStore.recover]'); callbackStore.send( ACCOUNT_CALLBACK.toString(), [{ @@ -42,7 +41,6 @@ export const useAccountStore = defineStore('account', () => { ); }; const replace = () => { - console.debug('[accountStore.replace]'); callbackStore.send( ACCOUNT_CALLBACK.toString(), [{ @@ -55,7 +53,6 @@ export const useAccountStore = defineStore('account', () => { ); }; const signIn = () => { - console.debug('[accountStore.signIn]'); callbackStore.send( ACCOUNT_CALLBACK.toString(), [{ @@ -68,7 +65,6 @@ export const useAccountStore = defineStore('account', () => { ); }; const signOut = () => { - console.debug('[accountStore.signOut]'); callbackStore.send( ACCOUNT_CALLBACK.toString(), [{ @@ -81,7 +77,6 @@ export const useAccountStore = defineStore('account', () => { ); }; const trialExtend = () => { - console.debug('[accountStore.trialExtend]'); callbackStore.send( ACCOUNT_CALLBACK.toString(), [{ @@ -94,7 +89,6 @@ export const useAccountStore = defineStore('account', () => { ); }; const trialStart = () => { - console.debug('[accountStore.trialStart]'); callbackStore.send( ACCOUNT_CALLBACK.toString(), [{ @@ -111,7 +105,6 @@ export const useAccountStore = defineStore('account', () => { * @note unraid-api requires apikey & token realted keys to be lowercase */ const updatePluginConfig = async (action: ExternalSignIn | ExternalSignOut) => { - console.debug('[accountStore.updatePluginConfig]', action); // save any existing username before updating if (serverStore.username) { username.value = serverStore.username; } @@ -119,7 +112,6 @@ export const useAccountStore = defineStore('account', () => { accountActionStatus.value = 'updating'; if (!serverStore.registered && !accountAction.value.user) { - console.debug('[accountStore.updatePluginConfig] Not registered skipping sign out'); accountActionHide.value = true; accountActionStatus.value = 'success'; return; @@ -154,11 +146,9 @@ export const useAccountStore = defineStore('account', () => { }) .post() .res((res) => { - console.debug('[accountStore.updatePluginConfig] WebguiUpdate res', res); accountActionStatus.value = 'success'; }) .catch((err) => { - console.debug('[accountStore.updatePluginConfig] WebguiUpdate err', err); accountActionStatus.value = 'failed'; errorsStore.setError({ heading: 'Failed to update Connect account configuration', @@ -170,7 +160,6 @@ export const useAccountStore = defineStore('account', () => { }); return response; } catch (err) { - console.debug('[accountStore.updatePluginConfig] WebguiUpdate catch err', err); accountActionStatus.value = 'failed'; errorsStore.setError({ heading: 'Failed to update Connect account configuration', diff --git a/web/store/callbackActions.ts b/web/store/callbackActions.ts index 20d54cda0..23f3ca705 100644 --- a/web/store/callbackActions.ts +++ b/web/store/callbackActions.ts @@ -20,8 +20,6 @@ export const useCallbackActionsStore = defineStore('callbackActions', () => { const saveCallbackData = ( decryptedData?: QueryPayloads, ) => { - console.debug('[saveCallbackData]', { decryptedData }); - if (decryptedData) { callbackData.value = decryptedData; } @@ -34,8 +32,6 @@ export const useCallbackActionsStore = defineStore('callbackActions', () => { }; const redirectToCallbackType = () => { - console.debug('[redirectToCallbackType]'); - if (!callbackData.value || !callbackData.value.type || callbackData.value.type !== 'forUpc' || !callbackData.value.actions?.length) { callbackError.value = 'Callback redirect type not present or incorrect'; callbackStatus.value = 'ready'; // default status @@ -46,7 +42,6 @@ export const useCallbackActionsStore = defineStore('callbackActions', () => { // Parse the data and perform actions callbackData.value.actions.forEach(async (action, index, array) => { - console.debug('[action]', action); if (action?.keyUrl) { await installKeyStore.install(action as ExternalKeyActions); } @@ -73,7 +68,6 @@ export const useCallbackActionsStore = defineStore('callbackActions', () => { const setCallbackStatus = (status: CallbackStatus) => { callbackStatus.value = status; }; watch(callbackStatus, (newVal, oldVal) => { - console.debug('[callbackStatus]', newVal); if (newVal === 'loading') { addPreventClose(); } diff --git a/web/store/dropdown.ts b/web/store/dropdown.ts index 834ce760a..f11aae6ad 100644 --- a/web/store/dropdown.ts +++ b/web/store/dropdown.ts @@ -21,7 +21,6 @@ export const useDropdownStore = defineStore('dropdown', () => { */ const serverStateEnokeyfile = computed(() => serverStore.state === 'ENOKEYFILE'); watch(serverStateEnokeyfile, (newVal, oldVal) => { - console.debug('[watch.serverStateEnokeyfile]', newVal, oldVal); const autoOpenSessionStorage = `unraid_${serverStore.guid.slice(-12) ?? 'NO_GUID'}_ENOKEYFILE`; if (newVal && !sessionStorage.getItem(autoOpenSessionStorage)) { sessionStorage.setItem(autoOpenSessionStorage, 'true'); diff --git a/web/store/errors.ts b/web/store/errors.ts index bbdc20924..fb9abcea2 100644 --- a/web/store/errors.ts +++ b/web/store/errors.ts @@ -42,7 +42,6 @@ export const useErrorsStore = defineStore('errors', () => { }; const setError = (error: Error) => { - console.debug('[setError]', error); errors.value.push(error); }; @@ -52,27 +51,22 @@ export const useErrorsStore = defineStore('errors', () => { } const openTroubleshoot = async (payload: TroubleshootPayload) => { - console.debug('[openTroubleshoot]', payload); try { // @ts-ignore – `FeedbackButton` will be included in 6.10.4+ DefaultPageLayout await FeedbackButton(); // once the modal is visible we need to select the radio to correctly show the bug report form let $modal = document.querySelector('.sweet-alert.visible'); while (!$modal) { - console.debug('[openTroubleshoot] getting $modal…'); await new Promise(resolve => setTimeout(resolve, 100)); $modal = document.querySelector('.sweet-alert.visible'); } - console.debug('[openTroubleshoot] $modal', $modal); // autofill errors into the bug report form if (errors.value.length) { let $textarea: HTMLInputElement | null = $modal.querySelector('#troubleshootDetails'); while (!$textarea) { - console.debug('[openTroubleshoot] getting $textarea…'); await new Promise(resolve => setTimeout(resolve, 100)); $textarea = $modal.querySelector('#troubleshootDetails'); } - console.debug('[openTroubleshoot] $textarea', $textarea); const errorMessages = errors.value.map((error, index) => { const index1 = index + 1; let message = `• Error ${index1}: ${error.heading}\n`; @@ -91,11 +85,9 @@ export const useErrorsStore = defineStore('errors', () => { // autofill emails let $emailInput: HTMLInputElement | null = $modal.querySelector('#troubleshootEmail'); while (!$emailInput) { - console.debug('[openTroubleshoot] getting $emailInput…'); await new Promise(resolve => setTimeout(resolve, 100)); $emailInput = $modal.querySelector('#troubleshootEmail'); } - console.debug('[openTroubleshoot] $emailInput', $emailInput); if (payload.email) { $emailInput.value = payload.email; } else { diff --git a/web/store/installKey.ts b/web/store/installKey.ts index 7d667abf8..6d738e5af 100644 --- a/web/store/installKey.ts +++ b/web/store/installKey.ts @@ -29,7 +29,6 @@ export const useInstallKeyStore = defineStore('installKey', () => { }); const install = async (action: ExternalKeyActions) => { - console.debug('[install]'); keyInstallStatus.value = 'installing'; keyAction.value = action; @@ -68,10 +67,6 @@ export const useInstallKeyStore = defineStore('installKey', () => { } }; - watch(keyInstallStatus, (newV, oldV) => { - console.debug('[keyInstallStatus]', newV, oldV); - }); - return { // State keyInstallStatus, diff --git a/web/store/purchase.ts b/web/store/purchase.ts index 61c2f60c7..4e92fda32 100644 --- a/web/store/purchase.ts +++ b/web/store/purchase.ts @@ -15,7 +15,6 @@ export const usePurchaseStore = defineStore('purchase', () => { const serverStore = useServerStore(); const redeem = () => { - console.debug('[serverStore.redeem]'); callbackStore.send( PURCHASE_CALLBACK.toString(), [{ @@ -28,7 +27,6 @@ export const usePurchaseStore = defineStore('purchase', () => { ); }; const purchase = () => { - console.debug('[serverStore.purchase]'); callbackStore.send( PURCHASE_CALLBACK.toString(), [{ @@ -41,7 +39,6 @@ export const usePurchaseStore = defineStore('purchase', () => { ); }; const upgrade = () => { - console.debug('[serverStore.upgrade]'); callbackStore.send( PURCHASE_CALLBACK.toString(), [{ diff --git a/web/store/server.ts b/web/store/server.ts index 4237715df..9cd04ce2c 100644 --- a/web/store/server.ts +++ b/web/store/server.ts @@ -544,7 +544,6 @@ export const useServerStore = defineStore('server', () => { // Keeping separate from validApiKeyLength because we may want to add more checks. Cloud also help with debugging user error submissions. if (apiKey.value.length !== 64) { - console.debug('[invalidApiKey] invalid length'); return { heading: 'Invalid API Key', level: 'error', @@ -554,7 +553,6 @@ export const useServerStore = defineStore('server', () => { }; } if (!apiKey.value.startsWith('unupc_')) { - console.debug('[invalidApiKey] invalid for upc'); return { heading: 'Invalid API Key Format', level: 'error', @@ -566,7 +564,6 @@ export const useServerStore = defineStore('server', () => { return undefined; }); watch(invalidApiKey, (newVal, oldVal) => { - console.debug('[watch:invalidApiKey]', newVal, oldVal); if (oldVal && oldVal.ref) { errorsStore.removeErrorByRef(oldVal.ref); } if (newVal) { errorsStore.setError(newVal); } }); @@ -584,7 +581,6 @@ export const useServerStore = defineStore('server', () => { return undefined; }); watch(tooManyDevices, (newVal, oldVal) => { - console.debug('[watch:tooManyDevices]', newVal, oldVal); if (oldVal && oldVal.ref) { errorsStore.removeErrorByRef(oldVal.ref); } if (newVal) { errorsStore.setError(newVal); } }); @@ -610,7 +606,6 @@ export const useServerStore = defineStore('server', () => { return undefined; }); watch(pluginInstallFailed, (newVal, oldVal) => { - console.debug('[watch:pluginInstallFailed]', newVal, oldVal); if (oldVal && oldVal.ref) { errorsStore.removeErrorByRef(oldVal.ref); } if (newVal) { errorsStore.setError(newVal); } }); @@ -643,7 +638,6 @@ export const useServerStore = defineStore('server', () => { } : undefined)); watch(deprecatedUnraidSSL, (newVal, oldVal) => { - console.debug('[watch:deprecatedUnraidSSL]', newVal, oldVal); if (oldVal && oldVal.ref) { errorsStore.removeErrorByRef(oldVal.ref); } if (newVal) { errorsStore.setError(newVal); } }); @@ -672,7 +666,6 @@ export const useServerStore = defineStore('server', () => { }; }); watch(cloudError, (newVal, oldVal) => { - console.debug('[watch:cloudError]', newVal, oldVal); if (oldVal && oldVal.ref) { errorsStore.removeErrorByRef(oldVal.ref); } if (newVal) { errorsStore.setError(newVal); } }); @@ -692,20 +685,16 @@ export const useServerStore = defineStore('server', () => { */ const registeredWithValidApiKey = computed(() => registered.value && !invalidApiKey.value); watch(registeredWithValidApiKey, (newVal, oldVal) => { - console.debug('[watch:registeredWithValidApiKey]', newVal, oldVal); if (oldVal) { - console.debug('[watch:registeredWithValidApiKey] no apiKey, stop unraid-api client'); return unraidApiStore.closeUnraidApiClient(); } if (newVal) { // if this is just after sign in, let's delay the start by a few seconds to give unraid-api time to update if (accountStore.accountActionType === 'signIn') { - console.debug('[watch:registeredWithValidApiKey] delay start unraid-api client'); return setTimeout(() => { unraidApiStore.createApolloClient(); }, 2000); } else { - console.debug('[watch:registeredWithValidApiKey] new apiKey, start unraid-api client'); return unraidApiStore.createApolloClient(); } } @@ -714,7 +703,6 @@ export const useServerStore = defineStore('server', () => { * Actions */ const setServer = (data: Server) => { - console.debug('[setServer] data', data); if (typeof data?.apiKey !== 'undefined') { apiKey.value = data.apiKey; } if (typeof data?.apiVersion !== 'undefined') { apiVersion.value = data.apiVersion; } if (typeof data?.avatar !== 'undefined') { avatar.value = data.avatar; } @@ -745,7 +733,6 @@ export const useServerStore = defineStore('server', () => { if (typeof data?.uptime !== 'undefined') { uptime.value = data.uptime; } if (typeof data?.username !== 'undefined') { username.value = data.username; } if (typeof data?.wanFQDN !== 'undefined') { wanFQDN.value = data.wanFQDN; } - console.debug('[setServer] server', server.value); }; const mutateServerStateFromApi = (data: serverStateQuery): Server => { @@ -769,7 +756,6 @@ export const useServerStore = defineStore('server', () => { expireTime: (data.registration && data.registration.expiration) ? data.registration.expiration : 0, ...(data.cloud && { cloud: data.cloud }), }; - console.debug('[mutateServerStateFromApi] mutatedData', mutatedData); return mutatedData; }; @@ -781,7 +767,6 @@ export const useServerStore = defineStore('server', () => { const serverState = computed(() => resultServerState.value ?? null); apiServerStateRefresh.value = refetchServerState; watch(serverState, (value) => { - console.debug('[watch:serverState]', value); if (value) { const mutatedServerStateResult = mutateServerStateFromApi(value); setServer(mutatedServerStateResult); @@ -791,12 +776,10 @@ export const useServerStore = defineStore('server', () => { }; const phpServerStateRefresh = async () => { - console.debug('[phpServerStateRefresh] start'); try { const stateResponse: Server = await WebguiState .get() .json(); - console.debug('[phpServerStateRefresh] stateResponse', stateResponse); setServer(stateResponse); return stateResponse; } catch (error) { @@ -811,7 +794,6 @@ export const useServerStore = defineStore('server', () => { const refreshServerState = async () => { // If we've reached the refresh limit, stop refreshing if (refreshCount >= refreshLimit) { - console.debug('[refreshServerState] refresh limit reached, stop refreshing'); refreshServerStateStatus.value = 'timeout'; return false; } @@ -822,43 +804,27 @@ export const useServerStore = defineStore('server', () => { const oldRegistered = registered.value; const oldState = state.value; const fromApi = !!apiServerStateRefresh.value; - console.debug('[refreshServerState] start', { - fromApi, - refreshCount, - }); // Fetch the server state from the API or PHP const response = fromApi ? await apiServerStateRefresh.value() : await phpServerStateRefresh(); if (!response) { - console.debug('[refreshServerState] no response, fetch again in 250ms…'); return setTimeout(() => { refreshServerState(); }, refreshTimeout); } - console.debug('[refreshServerState] response', response); // Extract the new values from the response const newRegistered = fromApi && response?.data ? !!response.data.owner.username : response.registered; const newState = fromApi && response?.data ? response.data.vars.regState : response.state; // Compare the new values to the old values const registrationStatusChanged = oldRegistered !== newRegistered; const stateChanged = oldState !== newState; - console.debug('[refreshServerState] newState', { - oldRegistered, - newRegistered, - oldState, - newState, - registrationStatusChanged, - stateChanged, - }); // If the registration status or state changed, stop refreshing if (registrationStatusChanged || stateChanged) { - console.debug('[refreshServerState] change detected, stop refreshing', { registrationStatusChanged, stateChanged }); refreshServerStateStatus.value = 'done'; return true; } // If we haven't reached the refresh limit, try again - console.debug('[refreshServerState] no change, fetch again in 250ms…', { registrationStatusChanged, stateChanged }); setTimeout(() => { return refreshServerState(); }, refreshTimeout); diff --git a/web/store/theme.ts b/web/store/theme.ts index 65ffc962d..da952be73 100644 --- a/web/store/theme.ts +++ b/web/store/theme.ts @@ -30,7 +30,6 @@ export const useThemeStore = defineStore('theme', () => { }); // Actions const setTheme = (data: Theme) => { - console.debug('[setTheme]'); theme.value = data; }; const setCssVars = () => { diff --git a/web/store/trial.ts b/web/store/trial.ts index dfdf227b0..8aa0e43c2 100644 --- a/web/store/trial.ts +++ b/web/store/trial.ts @@ -26,14 +26,12 @@ export const useTrialStore = defineStore('trial', () => { const trialModalVisible = computed(() => trialStatus.value === 'failed' || trialStatus.value === 'trialExtend' || trialStatus.value === 'trialStart'); const requestTrial = async (type?: TrialExtend | TrialStart) => { - console.debug('[requestTrial]'); try { const payload = { guid: serverStore.guid, timestamp: Math.floor(Date.now() / 1000), }; const response: StartTrialResponse = await startTrial(payload).json(); - console.debug('[requestTrial]', response); if (!response.license) { trialStatus.value = 'failed'; return console.error('[requestTrial]', 'No license returned', response); @@ -49,7 +47,6 @@ export const useTrialStore = defineStore('trial', () => { sender: window.location.href, type: 'forUpc', }; - console.debug('[requestTrial]', trialStartData); trialStatus.value = 'success'; return callbackActionsStore.redirectToCallbackType(trialStartData); } catch (error) { @@ -62,8 +59,7 @@ export const useTrialStore = defineStore('trial', () => { trialStatus.value = status; }; - watch(trialStatus, (newVal, oldVal) => { - console.debug('[trialStatus]', newVal, oldVal); + watch(trialStatus, (newVal) => { // opening if (newVal === 'trialExtend' || newVal === 'trialStart') { addPreventClose(); diff --git a/web/store/unraidApi.ts b/web/store/unraidApi.ts index 73113414c..69f5ed710 100644 --- a/web/store/unraidApi.ts +++ b/web/store/unraidApi.ts @@ -29,14 +29,12 @@ const httpEndpoint = GRAPHQL; const wsEndpoint = new URL(GRAPHQL.toString().replace('http', 'ws')); export const useUnraidApiStore = defineStore('unraidApi', () => { - console.debug('[useUnraidApiStore]'); const accountStore = useAccountStore(); // const errorsStore = useErrorsStore(); const serverStore = useServerStore(); const unraidApiClient = ref>(); watch(unraidApiClient, (newVal, oldVal) => { - console.debug('[watch:unraidApiStore.unraidApiClient]', { newVal, oldVal }); if (newVal) { const apiResponse = serverStore.fetchServerFromApi(); if (apiResponse) { @@ -48,9 +46,6 @@ export const useUnraidApiStore = defineStore('unraidApi', () => { // const unraidApiErrors = ref([]); const unraidApiStatus = ref<'connecting' | 'offline' | 'online' | 'restarting'>('offline'); - watch(unraidApiStatus, (newVal, oldVal) => { - console.debug('[watch:unraidApiStore.unraidApiStatus]', { newVal, oldVal }); - }); const unraidApiRestartAction = computed((): UserProfileLink | undefined => { const { connectPluginInstalled, stateDataError } = serverStore; @@ -69,9 +64,9 @@ export const useUnraidApiStore = defineStore('unraidApi', () => { * Automatically called when an apiKey is set in the serverStore */ const createApolloClient = () => { - console.debug('[useUnraidApiStore.createApolloClient]', serverStore.apiKey); + // sign out imminent, skipping createApolloClient if (accountStore.accountActionType === 'signOut') { - return console.debug('[useUnraidApiStore.createApolloClient] sign out imminent, skipping createApolloClient'); + return; } unraidApiStatus.value = 'connecting'; @@ -97,7 +92,6 @@ export const useUnraidApiStore = defineStore('unraidApi', () => { */ const errorLink = onError(({ graphQLErrors, networkError }) => { if (graphQLErrors) { - console.debug('[GraphQL error]', graphQLErrors); graphQLErrors.map((error) => { console.error('[GraphQL error]', error, error.error.message); if (error.error.message.includes('offline')) { @@ -108,7 +102,6 @@ export const useUnraidApiStore = defineStore('unraidApi', () => { } return error.message; }); - console.debug('[GraphQL error]', graphQLErrors); } if (networkError && !prioritizeCorsError) { @@ -125,7 +118,6 @@ export const useUnraidApiStore = defineStore('unraidApi', () => { attempts: { max: 20, retryIf: (error, _operation) => { - console.debug('[retryLink.retryIf]', { error, _operation, prioritizeCorsError }); return !!error && !prioritizeCorsError; // don't retry when ERROR_CORS_403 }, }, @@ -164,14 +156,14 @@ export const useUnraidApiStore = defineStore('unraidApi', () => { }); provideApolloClient(unraidApiClient.value); - console.debug('[useUnraidApiStore.createApolloClient] 🏁 CREATED'); }; /** * Automatically called when an apiKey is unset in the serverStore */ const closeUnraidApiClient = async () => { - console.debug('[useUnraidApiStore.closeUnraidApiClient] STARTED'); - if (!unraidApiClient.value) { return console.debug('[useUnraidApiStore.closeUnraidApiClient] unraidApiClient not set'); } + if (!unraidApiClient.value) { + return; + } if (unraidApiClient.value) { await unraidApiClient.value.clearStore(); unraidApiClient.value.stop(); @@ -179,7 +171,6 @@ export const useUnraidApiStore = defineStore('unraidApi', () => { } unraidApiClient.value = undefined; unraidApiStatus.value = 'offline'; - console.debug('[useUnraidApiStore.closeUnraidApiClient] DONE'); }; const restartUnraidApiClient = async () => { @@ -188,7 +179,6 @@ export const useUnraidApiStore = defineStore('unraidApi', () => { csrf_token: serverStore.csrf, command: 'start', }); - console.debug('[restartUnraidApiClient]', response); return setTimeout(() => { if (unraidApiClient.value) { createApolloClient();