Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
chore: Refactor AddEditLocationModal to improve code readability and …
Browse files Browse the repository at this point in the history
…maintainability
  • Loading branch information
MoizAdnan committed Aug 14, 2024
1 parent 0bfab2a commit 10efdfb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ export default function AddEditLocationModal(props: { location?: LocationType; s

const locationID = useHookstate(props.location?.id || null)

const locationQuery = useFind(locationPath, { query: { id: locationID.value } })
const params = {
query: {
id: locationID.value
}
}

const locationQuery = useFind(locationPath, locationID.value ? params : undefined)
const location = locationID.value ? locationQuery.data[0] : undefined

const locationMutation = useMutation(locationPath)
Expand Down

0 comments on commit 10efdfb

Please sign in to comment.