'use client' //todo: use server components import Link from 'next/link' import React from 'react' import { deleteOrganizationFromBackend } from '@services/organizations/orgs' import useSWR, { mutate } from 'swr' import { swrFetcher } from '@services/utils/ts/requests' import { getAPIUrl, getUriWithOrg } from '@services/config/config' const Organizations = () => { const { data: organizations, error } = useSWR( `${getAPIUrl()}orgs/user/page/1/limit/10`, swrFetcher ) async function deleteOrganization(org_id: any) { const response = await deleteOrganizationFromBackend(org_id) response && mutate( `${getAPIUrl()}orgs/user/page/1/limit/10`, organizations.filter((org: any) => org.org_id !== org_id) ) } return ( <>
Failed to load
} {!organizations ? (Loading...
) : (