After the fetch quote data is called, data contains the correct object. However quotes and quotesC remains undefined and I cannot figure out how to populate it other than using the custom fetch's transformer function. If i use the transformer and set the quotes ref from within there, it works. The object does contain "Quotes" it is definitely there.
// Store
export const useQuoteDataStore = defineStoreWithHMR('quote-data', () => {
const data = ref({});
const quotes = ref<Quote[]>([]);
const fetchQuoteData = async () => {
const result = await useXFetch('/api/Quote/action/GetQuoteDetails', {
query: {
EntityID: 3,
QuoteType: 0
}
});
data.value = result.data;
if (result.data) {
quotes.value = result.data.Quotes;
}
return result;
}
const quotesC = computed<QuoteDto[]>(() => data.value.Quotes);
return {
data,
quotes,
quotesC,
fetchQuoteData,
}
});