teableio/teable

View on GitHub
packages/sdk/src/hooks/use-session.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { useContext, useMemo } from 'react';
import { SessionContext } from '../context';

export const useSession = () => {
  const { user, refresh, refreshAvatar } = useContext(SessionContext);
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  return useMemo(() => ({ user: user!, refresh, refreshAvatar }), [user, refresh, refreshAvatar]);
};