import React from "react";
import { useTranslation } from "react-i18next";
import { Button } from "react-native";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { signOutStart } from "../../redux/user/user.actions";
import { employeeSignOut } from "../../redux/employee/employee.actions";
const mapStateToProps = createStructuredSelector({
  //currentUser: selectCurrentUser
});
const mapDispatchToProps = (dispatch) => ({
  //setUserLanguage: language => dispatch(setUserLanguage(language))
  signOutStart: () => dispatch(signOutStart()),
  signOut: () => dispatch(employeeSignOut()),
});

export function SignOutButton({ signOutStart, signOut }) {
  const { t } = useTranslation();
  return (
    <Button
      style={{ margin: 8 }}
      onPress={() => (signOut(),signOutStart())}
      title={t("general.actions.signout")}
    />
  );
}
export default connect(mapStateToProps, mapDispatchToProps)(SignOutButton);
