Fixed usages with profile store in api.
Build and Deploy Web App / build-and-deploy (push) Successful in 19s Details

This commit is contained in:
andrewlalis 2025-08-22 21:07:18 -04:00
parent ca87d2723c
commit 05820e6e0e
2 changed files with 3 additions and 9 deletions

View File

@ -17,14 +17,9 @@ const profileStore = useProfileStore()
const transaction: Ref<TransactionDetail | undefined> = ref() const transaction: Ref<TransactionDetail | undefined> = ref()
onMounted(async () => { onMounted(async () => {
if (!profileStore.state) {
await router.replace('/')
return
}
const transactionId = parseInt(route.params.id as string) const transactionId = parseInt(route.params.id as string)
try { try {
const api = new TransactionApiClient(profileStore.state) const api = new TransactionApiClient()
transaction.value = await api.getTransaction(transactionId) transaction.value = await api.getTransaction(transactionId)
} catch (err) { } catch (err) {
console.error(err) console.error(err)
@ -40,7 +35,7 @@ async function deleteTransaction() {
const conf = await showConfirm('Are you sure you want to delete this transaction? This will permanently delete all data pertaining to this transaction, and it cannot be recovered.') const conf = await showConfirm('Are you sure you want to delete this transaction? This will permanently delete all data pertaining to this transaction, and it cannot be recovered.')
if (!conf) return if (!conf) return
try { try {
await new TransactionApiClient(profileStore.state).deleteTransaction(transaction.value.id) await new TransactionApiClient().deleteTransaction(transaction.value.id)
await router.replace(`/profiles/${profileStore.state.name}`) await router.replace(`/profiles/${profileStore.state.name}`)
} catch (err) { } catch (err) {
console.error(err) console.error(err)

View File

@ -18,8 +18,7 @@ onMounted(async () => {
}) })
async function fetchPage(pageRequest: PageRequest) { async function fetchPage(pageRequest: PageRequest) {
if (!profileStore.state) return const api = new TransactionApiClient()
const api = new TransactionApiClient(profileStore.state)
try { try {
transactions.value = await api.getTransactions(pageRequest) transactions.value = await api.getTransactions(pageRequest)
} catch (err) { } catch (err) {