feat: add create organisation button and dialog on platform page
Add "Nieuwe organisatie" button to the platform organisations list page. Dialog with name field (auto-generates slug) and slug field. Uses the existing POST /organisations endpoint. On success, navigates to the new organisation's detail page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import type {
|
||||
AdminOrganisationDetail,
|
||||
AdminOrganisationMember,
|
||||
AdminUser,
|
||||
CreateOrganisationPayload,
|
||||
ImpersonationResponse,
|
||||
InviteMemberPayload,
|
||||
PlatformStats,
|
||||
@@ -77,6 +78,23 @@ export function useUpdateAdminOrganisation() {
|
||||
})
|
||||
}
|
||||
|
||||
export function useCreateOrganisation() {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (payload: CreateOrganisationPayload) => {
|
||||
const { data } = await apiClient.post<ApiResponse<AdminOrganisation>>(
|
||||
'/organisations',
|
||||
payload,
|
||||
)
|
||||
return data.data
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['admin', 'organisations'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteAdminOrganisation() {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user