"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const react_router_dom_1 = require("react-router-dom");
const icons_1 = require("@ant-design/icons");
const Main_1 = require("@/pages/builder/header/Main");
function GoBack() {
    const history = (0, react_router_dom_1.useHistory)();
    const { state } = (0, react_router_dom_1.useLocation)();
    const handleBack = () => {
        let pathname;
        let search = '';
        if (state === null || state === void 0 ? void 0 : state.backPathname) {
            pathname = state.backPathname;
            search = (state === null || state === void 0 ? void 0 : state.backSearch) || '';
        }
        else {
            pathname = '/workspace/projects/list';
        }
        history.push({ pathname, search });
    };
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement(Main_1.StyledIcon, { onClick: handleBack },
            react_1.default.createElement(icons_1.LeftOutlined, null))));
}
exports.default = GoBack;
