import LoginCallBack from "@Front/Components/Layouts/LoginCallback";
import { useEffect } from "react";

export default function Route() {
    useEffect(() => {
        if (typeof window !== "undefined") {
            const origin = window.location.origin;
            const search = window.location.search || "";
            // Forcer HTTPS et domaine dev4 après retour ID.not
            if (!origin.startsWith("https://dev4.4nkweb.com")) {
                const target = `https://dev4.4nkweb.com/lecoffre/authorized-client${search}`;
                window.location.replace(target);
                return;
            }
            if (origin.startsWith("http://dev3.4nkweb.com")) {
                const search = window.location.search || "";
                const target = `https://dev4.4nkweb.com/lecoffre/authorized-client${search}`;
                window.location.replace(target);
            }
        }
    }, []);

    return <LoginCallBack />;
}
