[notification] set notification if new user is set
This commit is contained in:
parent
b84bfb2cc3
commit
c9e8e9cddb
|
@ -11,6 +11,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { Notify } from 'quasar';
|
||||
import MainUserSettings from './settings/MainUserSettings.vue';
|
||||
import { useUserStore } from '@flaschengeist/api';
|
||||
|
||||
|
@ -19,17 +20,39 @@ export default defineComponent({
|
|||
components: { MainUserSettings },
|
||||
setup() {
|
||||
const userStore = useUserStore();
|
||||
const user = ref<FG.User>({
|
||||
const emptyUser = {
|
||||
userid: '',
|
||||
display_name: '',
|
||||
firstname: '',
|
||||
lastname: '',
|
||||
mail: '',
|
||||
roles: [],
|
||||
});
|
||||
}
|
||||
const user = ref<FG.User>(emptyUser);
|
||||
|
||||
|
||||
async function setUser(value: FG.User) {
|
||||
try {
|
||||
await userStore.createUser(value);
|
||||
Notify.create({
|
||||
color: "positive",
|
||||
message: "Neuer User wurde angelegt.",
|
||||
timeout: 5000,
|
||||
group: false,
|
||||
actions: [{ icon: 'mdi-close', color: 'white' }],
|
||||
textColor: "white"
|
||||
})
|
||||
user.value = emptyUser
|
||||
} catch {
|
||||
Notify.create({
|
||||
color: "negative",
|
||||
message: "Neuer User konnte nicht angelegt werden.",
|
||||
timeout: 10000,
|
||||
group: false,
|
||||
actions: [{ icon: 'mdi-close', color: 'white' }],
|
||||
textColor: "white"
|
||||
})
|
||||
}
|
||||
}
|
||||
return { user, setUser };
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue