[notification] set notification if new user is set
This commit is contained in:
parent
b84bfb2cc3
commit
c9e8e9cddb
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref } from 'vue';
|
import { defineComponent, ref } from 'vue';
|
||||||
|
import { Notify } from 'quasar';
|
||||||
import MainUserSettings from './settings/MainUserSettings.vue';
|
import MainUserSettings from './settings/MainUserSettings.vue';
|
||||||
import { useUserStore } from '@flaschengeist/api';
|
import { useUserStore } from '@flaschengeist/api';
|
||||||
|
|
||||||
|
@ -19,17 +20,39 @@ export default defineComponent({
|
||||||
components: { MainUserSettings },
|
components: { MainUserSettings },
|
||||||
setup() {
|
setup() {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const user = ref<FG.User>({
|
const emptyUser = {
|
||||||
userid: '',
|
userid: '',
|
||||||
display_name: '',
|
display_name: '',
|
||||||
firstname: '',
|
firstname: '',
|
||||||
lastname: '',
|
lastname: '',
|
||||||
mail: '',
|
mail: '',
|
||||||
roles: [],
|
roles: [],
|
||||||
});
|
}
|
||||||
|
const user = ref<FG.User>(emptyUser);
|
||||||
|
|
||||||
|
|
||||||
async function setUser(value: FG.User) {
|
async function setUser(value: FG.User) {
|
||||||
await userStore.createUser(value);
|
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 };
|
return { user, setUser };
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue