Skip to content

Commit 2bd7cca

Browse files
committed
fix: add loader while oauthRedirecting
1 parent ff60f7e commit 2bd7cca

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

adminforth/spa/src/views/LoginView.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}: {}"
99
>
1010

11-
<img v-if="coreStore.config?.loginBackgroundImage && backgroundPosition !== 'over'"
11+
<img v-if="!oauthRedirecting && coreStore.config?.loginBackgroundImage && backgroundPosition !== 'over'"
1212
:src="loadFile(coreStore.config?.loginBackgroundImage)"
1313
class="position-absolute top-0 left-0 h-screen object-cover w-0"
1414
:class="{
@@ -21,8 +21,13 @@
2121
}[backgroundPosition]"
2222
/>
2323

24+
<div v-if="oauthRedirecting">
25+
<Spinner class="w-10 h-10" />
26+
</div>
27+
2428
<!-- Main modal -->
2529
<div id="authentication-modal" tabindex="-1"
30+
v-show="!oauthRedirecting"
2631
class="af-login-modal overflow-y-auto flex flex-grow
2732
overflow-x-hidden z-50 min-w-[350px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
2833
<div class="relative p-4 w-full max-h-full max-w-[400px]">
@@ -112,6 +117,7 @@
112117
:is="getCustomComponent(formatComponent(c))"
113118
:meta="formatComponent(c).meta"
114119
@update:disableLoginButton="setDisableLoginButton($event)"
120+
@update:oauthRedirecting="oauthRedirecting = $event"
115121
/>
116122
</form>
117123
</div>
@@ -132,8 +138,8 @@ import { useCoreStore } from '@/stores/core';
132138
import { useUserStore } from '@/stores/user';
133139
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
134140
import { callAdminForthApi, loadFile } from '@/utils';
135-
import { useRouter } from 'vue-router';
136-
import { Button, Checkbox, Input } from '@/afcl';
141+
import { useRouter, useRoute } from 'vue-router';
142+
import { Button, Checkbox, Input, Spinner } from '@/afcl';
137143
import ErrorMessage from '@/components/ErrorMessage.vue';
138144
139145
const passwordInput = ref<InstanceType<typeof Input> | null>(null);
@@ -143,6 +149,8 @@ const username = ref('');
143149
const password = ref('');
144150
145151
const router = useRouter();
152+
const route = useRoute();
153+
const oauthRedirecting = ref<boolean>('start_oauth' in route.query && route.query.start_oauth !== '');
146154
const inProgress = ref<boolean>(false);
147155
const isSuccess = ref<boolean>(false);
148156
const coreStore = useCoreStore();

0 commit comments

Comments
 (0)