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:
2026-04-15 01:27:40 +02:00
parent 66e4167c03
commit 2933d957a6
3 changed files with 123 additions and 2 deletions

View File

@@ -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()