feat: add Authentik access widgets
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
/** Hooks for the Authentik directory + messaging tabs. */
|
||||
/** Hooks for Authentik directory, access metadata, and messaging tabs. */
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
fetchAuthentikAccessSummary,
|
||||
fetchAuthentikApplications,
|
||||
fetchAuthentikGroups,
|
||||
fetchAuthentikMessageStatus,
|
||||
fetchAuthentikUsers,
|
||||
sendAuthentikMessage,
|
||||
@@ -17,6 +20,33 @@ export function useAuthentikUsers(
|
||||
});
|
||||
}
|
||||
|
||||
export function useAuthentikAccessSummary(
|
||||
serviceId: string,
|
||||
params: { search?: string; page?: number; page_size?: number },
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: ["authentik", "access-summary", serviceId, params],
|
||||
queryFn: () => fetchAuthentikAccessSummary(serviceId, params),
|
||||
staleTime: 10_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useAuthentikGroups(serviceId: string, limit = 100) {
|
||||
return useQuery({
|
||||
queryKey: ["authentik", "groups", serviceId, limit],
|
||||
queryFn: () => fetchAuthentikGroups(serviceId, limit),
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useAuthentikApplications(serviceId: string, limit = 100) {
|
||||
return useQuery({
|
||||
queryKey: ["authentik", "applications", serviceId, limit],
|
||||
queryFn: () => fetchAuthentikApplications(serviceId, limit),
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useSendAuthentikMessage(serviceId: string) {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
|
||||
Reference in New Issue
Block a user