import { isLoggedInMiddleware } from "@/middleware";
import { useCurrentUser } from "@/hooks";
import React from "react";
import { Middleware } from "@/routing";

export const isManagerMiddleware: Middleware<any, any> = Next => isLoggedInMiddleware(() => {
    const user = useCurrentUser();

    if (user.isManager) {
        return <Next />;
    }

    return <div />;
})
