mirror of
https://github.com/maciejpedzich/racemash.git
synced 2024-11-27 16:15:47 +01:00
Remove title field and rename color to message
This commit is contained in:
parent
f8465276e3
commit
92e43959e6
@ -18,8 +18,7 @@ onMounted(async () => {
|
|||||||
if (router.currentRoute.value.hash === '#login-success') {
|
if (router.currentRoute.value.hash === '#login-success') {
|
||||||
localStorage.removeItem('redirectPath');
|
localStorage.removeItem('redirectPath');
|
||||||
showSnackbar({
|
showSnackbar({
|
||||||
color: 'success',
|
status: 'success',
|
||||||
title: 'Success',
|
|
||||||
message: "You're logged in!"
|
message: "You're logged in!"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useSnackbar } from '@/composables/useSnackbar';
|
import { useSnackbar } from '@/composables/useSnackbar';
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
const { visible, color, title, message } = useSnackbar();
|
const { visible, status, message } = useSnackbar();
|
||||||
|
const title = computed(() => (status.value === 'error' ? 'Error' : 'Success'));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-snackbar v-model="visible" :color="color" vertical>
|
<v-snackbar v-model="visible" :color="status" vertical>
|
||||||
<h6 class="text-h6 mb-1">{{ title }}</h6>
|
<h6 class="text-h6 mb-1">{{ title }}</h6>
|
||||||
<p class="text-body-1">{{ message }}</p>
|
<p class="text-body-1">{{ message }}</p>
|
||||||
</v-snackbar>
|
</v-snackbar>
|
||||||
|
@ -2,14 +2,12 @@ import { reactive, toRefs } from 'vue';
|
|||||||
|
|
||||||
interface Snackbar {
|
interface Snackbar {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
color: '' | 'error' | 'success';
|
status: '' | 'error' | 'success';
|
||||||
title: string;
|
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const snackbar = reactive<Snackbar>({
|
const snackbar = reactive<Snackbar>({
|
||||||
color: '',
|
status: '',
|
||||||
title: '',
|
|
||||||
message: '',
|
message: '',
|
||||||
visible: false
|
visible: false
|
||||||
});
|
});
|
||||||
|
@ -12,8 +12,7 @@ const { showSnackbar } = useSnackbar();
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (route.hash === '#login-error') {
|
if (route.hash === '#login-error') {
|
||||||
showSnackbar({
|
showSnackbar({
|
||||||
color: 'error',
|
status: 'error',
|
||||||
title: 'Error',
|
|
||||||
message: 'Failed to log you in.'
|
message: 'Failed to log you in.'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user