feat: Implement initial with admin and mobile clients, authentication, data models, and lead generation scripts.
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
import { MOCK_STELLEN } from '@/lib/mock-data'
|
||||
import { trpc } from '@/lib/trpc'
|
||||
|
||||
export function useStellenListe(opts?: { sparte?: string; lehrjahr?: string }) {
|
||||
let data = MOCK_STELLEN.filter((s) => s.aktiv)
|
||||
if (opts?.sparte) data = data.filter((s) => s.sparte === opts.sparte)
|
||||
if (opts?.lehrjahr) data = data.filter((s) => s.lehrjahr === opts.lehrjahr)
|
||||
return { data, isLoading: false, refetch: () => {}, isRefetching: false }
|
||||
const { data, isLoading, refetch, isFetching } = trpc.stellen.listPublic.useQuery({
|
||||
sparte: opts?.sparte,
|
||||
lehrjahr: opts?.lehrjahr,
|
||||
})
|
||||
|
||||
return {
|
||||
data: data ?? [],
|
||||
isLoading,
|
||||
refetch,
|
||||
isRefetching: isFetching,
|
||||
}
|
||||
}
|
||||
|
||||
export function useStelleDetail(id: string) {
|
||||
const data = MOCK_STELLEN.find((s) => s.id === id) ?? null
|
||||
return { data, isLoading: false }
|
||||
const { data, isLoading } = trpc.stellen.byId.useQuery({ id })
|
||||
return { data: data ?? null, isLoading }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user