import { __awaiter } from "tslib";
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
import React from "react";
import { useRouter } from "next/router";
import Cookies from "js-cookie";
function _setToken() {
    const router = useRouter();
    React.useEffect(() => {
        const { token, projectID } = router.query;
        if (token && typeof token === "string") {
            Cookies.set("token", token, { expires: 30 });
            router.push({
                pathname: `/apps/project/${projectID}`,
                query: router.query.env && { env: router.query.env },
            });
        }
    }, [router.query]);
    return _jsx("div", {});
}
// enable SSR to expose env
_setToken.getInitialProps = (ctx) => __awaiter(void 0, void 0, void 0, function* () { return ({}); });
export default _setToken;
//# sourceMappingURL=%5Btoken%5D.js.map