import * as React from 'react';
import {AuthContext} from "../context/AuthContext";

export function useAuth() {
    const context = React.useContext(AuthContext);

    if (!context) {
        throw new Error('useAuth must be used within a AuthProvider');
    }

    window.auth = context;

    return context;
}
