Pixel/link metrics pages.
This commit is contained in:
20
src/app/(main)/teams/TeamProvider.tsx
Normal file
20
src/app/(main)/teams/TeamProvider.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
'use client';
|
||||
import { createContext, ReactNode } from 'react';
|
||||
import { useTeamQuery } from '@/components/hooks';
|
||||
import { Loading } from '@umami/react-zen';
|
||||
|
||||
export const TeamContext = createContext(null);
|
||||
|
||||
export function TeamProvider({ teamId, children }: { teamId?: string; children: ReactNode }) {
|
||||
const { data: team, isLoading, isFetching } = useTeamQuery(teamId);
|
||||
|
||||
if (isFetching && isLoading) {
|
||||
return <Loading position="page" />;
|
||||
}
|
||||
|
||||
if (!team) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <TeamContext.Provider value={team}>{children}</TeamContext.Provider>;
|
||||
}
|
||||
Reference in New Issue
Block a user