Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

413 B
Raw Blame
import { createContext, useContext } from 'react';

import { Server } from '@colanode/client/types';

export interface AuthContextValue {
  server: Server;
}

export const AuthContext = createContext<AuthContextValue | null>(null);

export const useAuth = () => {
  const context = useContext(AuthContext);
  if (!context) {
    throw new Error('useAuth must be used within AuthLayout');
  }
  return context;
};