refactor(components): add initialValue prop to the find-user component

in case we want to change instead of create
This commit is contained in:
parent 74995f626b
commit ba13c4a52f
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -1,17 +1,24 @@
<script lang="ts" setup>
import { debounce } from "lodash-es";
import { useField } from "vee-validate";
const props = defineProps<{ fieldName: string; multi: boolean }>();
const props = defineProps<{
fieldName: string;
multi: boolean;
initialOption: {
label: string;
value: number;
} | null;
}>();
const state = reactive<{
data: { value: number; label: string }[];
fetching: boolean;
}>({
data: [],
data: props.initialOption ? [props.initialOption] : [],
fetching: false,
});
let fieldo = useField<number | number[]>(props.fieldName, undefined, {
// @ts-ignore
initialValue: null,
initialValue: props.initialOption?.value || null,
});
const { value, errorMessage, name, setValue } = fieldo;