import { updateHomeInfo } from "../actions/homeActions";
import { pushPanel } from "../actions/panelActions";
import { panel_names } from "../utils/Config";

export const handleBypassLink = (bypass) => (dispatch) => {
  console.log("[handleBypassLink] ~ bypass: ", bypass);
  const { name, panelInfo } = JSON.parse(bypass);
  if (name) {
    const action = name === panel_names.HOME_PANEL ? updateHomeInfo : pushPanel;

    dispatch(action({ name, panelInfo }));
  }
};
