import { useContext } from "react";

import { AuthContextProps, AuthorizedContext } from "./AuthorizedContext";

export const useAuthorizedContext = (): AuthContextProps => {
	const context = useContext(AuthorizedContext);
	if (!context) {
		throw new Error(
			"useAuthorizedContext должен использоваться внутри AuthProvider"
		);
	}
	return context;
};
