How to switch between two queries based on condition (type-safe) - TanStack