fix(web): sign out ux hide api error

This commit is contained in:
Zack Spear
2023-09-01 16:01:07 -07:00
parent dffc35be74
commit e3c3cb0688
6 changed files with 28 additions and 5 deletions

View File

@@ -48,7 +48,6 @@ const {
refreshServerStateStatus,
username,
} = storeToRefs(serverStore);
/**
* Post sign in success state:
* If we're on the Connect settings page in the webGUI
@@ -145,6 +144,12 @@ const accountActionStatusCopy = computed((): { text: string; } => {
return {
text: props.t('Ready to update Connect account configuration'),
};
case 'waiting':
return {
text: accountAction.value?.type === 'signIn'
? props.t('Signing In')
: props.t('Signing Out'),
};
case 'updating':
return {
text: accountAction.value?.type === 'signIn'

View File

@@ -198,5 +198,7 @@
"Install Recovered": "Install Recovered",
"Install Replaced": "Install Replaced",
"Your free Trial key provides all the functionality of a Pro Registration key": "Your free Trial key provides all the functionality of a Pro Registration key",
"Calculating trial expiration…": "Calculating trial expiration…"
"Calculating trial expiration…": "Calculating trial expiration…",
"Signing In": "Signing In",
"Signing Out": "Signing Out"
}

View File

@@ -30,7 +30,7 @@ export const useAccountStore = defineStore('account', () => {
// State
const accountAction = ref<ExternalSignIn | ExternalSignOut>();
const accountActionHide = ref<boolean>(false);
const accountActionStatus = ref<'failed' | 'ready' | 'success' | 'updating'>('ready');
const accountActionStatus = ref<'failed' | 'ready' | 'success' | 'updating' | 'waiting'>('ready');
/**
* Handling sign in / out via graph api
@@ -39,10 +39,16 @@ export const useAccountStore = defineStore('account', () => {
const connectSignInPayload = ref<ConnectSignInMutationPayload | undefined>();
const setConnectSignInPayload = (payload: ConnectSignInMutationPayload | undefined) => {
connectSignInPayload.value = payload;
if (payload) {
accountActionStatus.value = 'waiting';
}
};
const queueConnectSignOut = ref<boolean>(false);
const setQueueConnectSignOut = (data: boolean) => {
queueConnectSignOut.value = data;
if (data) {
accountActionStatus.value = 'waiting';
}
};
watchEffect(() => {
if (unraidApiClient.value && connectSignInPayload.value) {

View File

@@ -42,6 +42,7 @@ export const useErrorsStore = defineStore('errors', () => {
};
const setError = (error: Error) => {
console.error('[setError]', error);
errors.value.push(error);
};

View File

@@ -619,8 +619,15 @@ export const useServerStore = defineStore('server', () => {
});
const cloudError = computed((): Error | undefined => {
// if we're not registered then the cloud error should be ignored
if (!registered.value || !cloud.value?.error) { return; }
// if we're not registered or we're in the process of signing out then the cloud error should be ignored
if (!registered.value
|| !cloud.value?.error
|| accountStore.accountActionType === 'signOut'
|| accountStore.accountActionType === 'oemSignOut'
) {
return;
}
// otherwise if we are we should display any cloud errors
return {
actions: [
{

View File

@@ -89,6 +89,8 @@ export const useUnraidApiStore = defineStore('unraidApi', () => {
console.error('[GraphQL error]', error, error.error.message);
if (error.error.message.includes('offline')) {
unraidApiStatus.value = 'offline';
// attempt to automatically restart the unraid-api
if (unraidApiRestartAction) restartUnraidApiClient();
}
if (error.error.message && error.error.message.includes(ERROR_CORS_403)) {
prioritizeCorsError = true;