Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

591 B
Raw Blame
import { useContext } from 'react';

import { UnsavedChangesContext } from './unsavedChangesContext';
import type { UnsavedChangesActionAuthorization } from '../lib/unsavedChangesRegistry';

/** Confirm before a side-effecting action whose successful result navigates to another route. */
export function useUnsavedChangesActionGuard(): () => UnsavedChangesActionAuthorization | null {
  const context = useContext(UnsavedChangesContext);
  if (!context) throw new Error('useUnsavedChangesActionGuard must be used within an UnsavedChangesProvider');
  return context.authorizeRouteAction;
}