import { useLocation } from "react-router-dom";
import UserRequestResetPw from "../../components/user-request-pw-reset/user-request-reset-pw.component";
import UserValidatePwReset from "../../components/user-validate-pw-reset/user-validate-pw-reset.component";
import queryString from "query-string";

export default function ResetPassword() {
  const searchParams = queryString.parse(useLocation().search);
  const { mode, oobCode } = searchParams;

  if (mode === "resetPassword") return <UserValidatePwReset oobCode={oobCode} />;
  return <UserRequestResetPw />;
}
