|
1 | | -<template> |
2 | | - <div class="flex items-center justify-center min-h-screen bg-background"> |
3 | | - <Card class="w-full max-w-md p-6"> |
4 | | - <CardHeader> |
5 | | - <CardTitle class="text-center text-2xl font-bold">{{ t('logout.title') }}</CardTitle> |
6 | | - </CardHeader> |
7 | | - <CardContent> |
8 | | - <p class="text-center text-muted-foreground"> |
9 | | - {{ message }} |
10 | | - </p> |
11 | | - <div class="mt-4 flex justify-center"> |
12 | | - <svg v-if="isLoading" class="animate-spin h-8 w-8 text-primary" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> |
13 | | - <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> |
14 | | - <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> |
15 | | - </svg> |
16 | | - </div> |
17 | | - </CardContent> |
18 | | - </Card> |
19 | | - </div> |
20 | | -</template> |
21 | | - |
22 | 1 | <script setup lang="ts"> |
23 | 2 | import { onMounted, ref } from 'vue' |
24 | 3 | import { useRouter } from 'vue-router' |
25 | 4 | import { useI18n } from 'vue-i18n' |
26 | | -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' |
| 5 | +import { Card, CardContent } from '@/components/ui/card' |
| 6 | +import { Spinner } from '@/components/ui/spinner' |
27 | 7 | import { UserService } from '@/services/userService' |
28 | 8 |
|
29 | 9 | const router = useRouter() |
30 | 10 | const { t } = useI18n() |
31 | 11 |
|
32 | 12 | const isLoading = ref(true) |
33 | | -const message = ref(t('logout.inProgressMessage')) |
| 13 | +const message = ref('') |
34 | 14 |
|
35 | 15 | onMounted(async () => { |
36 | | - isLoading.value = true; |
37 | | - message.value = t('logout.inProgressMessage'); |
| 16 | + isLoading.value = true |
| 17 | + message.value = t('logout.inProgressMessage') |
38 | 18 | try { |
39 | | - // Use the UserService logout method which handles cache clearing |
40 | | - await UserService.logout(); |
41 | | - message.value = t('logout.successMessage') || t('logout.inProgressMessage'); |
| 19 | + await UserService.logout() |
| 20 | + message.value = t('logout.successMessage') |
42 | 21 | } catch (error) { |
43 | | - console.error('Error during logout:', error); |
44 | | - message.value = t('common.error'); |
| 22 | + console.error('Error during logout:', error) |
| 23 | + message.value = t('common.error') |
45 | 24 | } finally { |
46 | | - isLoading.value = false; |
| 25 | + isLoading.value = false |
47 | 26 | setTimeout(() => { |
48 | | - router.push('/login'); |
49 | | - }, 2000); // Redirect after 2 seconds to allow user to see final message |
| 27 | + router.push('/login') |
| 28 | + }, 2000) |
50 | 29 | } |
51 | 30 | }) |
52 | 31 | </script> |
53 | 32 |
|
54 | | -<style scoped> |
55 | | -/* Add any additional styles if needed */ |
56 | | -.bg-background { |
57 | | - background-color: hsl(var(--background)); |
58 | | -} |
59 | | -.text-primary { |
60 | | - color: hsl(var(--primary)); |
61 | | -} |
62 | | -.text-muted-foreground { |
63 | | - color: hsl(var(--muted-foreground)); |
64 | | -} |
65 | | -</style> |
| 33 | +<template> |
| 34 | + <div class="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8"> |
| 35 | + <div class="sm:mx-auto sm:w-full sm:max-w-sm"> |
| 36 | + <img |
| 37 | + class="mx-auto h-20 w-auto" |
| 38 | + src="/deploystack-logo-80x80.png" |
| 39 | + alt="DeployStack Logo" |
| 40 | + /> |
| 41 | + <h2 class="mt-10 text-center text-2xl font-bold tracking-tight text-gray-900"> |
| 42 | + {{ $t('logout.title') }} |
| 43 | + </h2> |
| 44 | + </div> |
| 45 | + |
| 46 | + <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm"> |
| 47 | + <Card> |
| 48 | + <CardContent class="pt-6"> |
| 49 | + <p class="text-center text-muted-foreground"> |
| 50 | + {{ message }} |
| 51 | + </p> |
| 52 | + <div v-if="isLoading" class="mt-4 flex justify-center"> |
| 53 | + <Spinner class="h-8 w-8" /> |
| 54 | + </div> |
| 55 | + </CardContent> |
| 56 | + </Card> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | +</template> |
0 commit comments