fix: minor bug
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2025-03-05 12:12:50 +01:00
parent 930265d790
commit c706ac42af
2 changed files with 4 additions and 10 deletions

View File

@ -159,9 +159,10 @@ onMounted(async () => {
const query = JSON.parse(route.query?.createForm);
formInitialData.value = query;
await onClientSelected({ ...formInitialData.value, clientId: query?.clientFk });
} else {
} else if (route.query?.table) {
const query = JSON.parse(route.query?.table);
await onClientSelected({ clientId: query?.clientFk });
const clientId = query?.clientFk;
if (clientId) await onClientSelected({ clientId });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
});
@ -171,7 +172,7 @@ watch(
async (newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
await onClientSelected({ clientId });
if (clientId) await onClientSelected({ clientId });
if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value;
}

View File

@ -263,15 +263,8 @@ const columns = computed(() => [
]);
const onClientSelected = async (formData) => {
resetAgenciesSelector(formData);
// await fetchClient(formData);
await fetchAddresses(formData);
};
const fetchClient = async (formData) => {
const response = await getClient(formData.clientId);
if (!response) return;
const [client] = response.data;
selectedClient.value = client;
};
const fetchAddresses = async (formData) => {
const { data } = await getAddresses(formData.clientId);