Allow empty value in UserSelector

This commit is contained in:
Ferdinand Thiessen 2021-02-04 02:43:22 +01:00
parent b2d54a046f
commit 50f1f028eb
1 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ export default defineComponent({
name: 'UserSelector',
props: {
label: { type: String, default: 'Benutzer' },
modelValue: { required: true, type: Object as PropType<FG.User> },
modelValue: { default: undefined, type: Object as PropType<FG.User | undefined> },
},
emits: { 'update:modelValue': (user: FG.User) => !!user },
setup(props, { emit }) {
@ -34,7 +34,7 @@ export default defineComponent({
const users = computed(() => store.state.users.users);
const selected = computed({
get: () => props.modelValue,
set: (value: FG.User) => emit('update:modelValue', value),
set: (value: FG.User | undefined) => (value ? emit('update:modelValue', value) : undefined),
});
return {