text: import axios from 'axios';
  
  export const setFavorite = (payload) => ({
    type: 'SET_FAVORITE',
    payload,
  });
  
  export const deleteFavorite = (payload) => ({
    type: 'DELETE_FAVORITE',
    payload,
  });
  
  export const loginRequest = (payload) => ({
    type: 'LOGIN_REQUEST',
    payload,
  });
  
  export const logoutRequest = (payload) => ({
    type: 'LOGOUT_REQUEST',
    payload,
  });
  
  export const registerRequest = (payload) => ({
    type: 'REGISTER_REQUEST',
    payload,
  });
  
  export const setError = (payload) => ({
    type: 'SET_ERROR',
    payload,
  });
  
  export const getVideoSource = (payload) => ({
    type: 'GET_VIDEO_SOURCE',
    payload,
  });
  
  //REGISTER
  export const registerUser = (payload, redirecUrl) => {
    return (dispatch) => {
      axios
        .post('/auth/sign-up', payload)
        .then(({ data }) => dispatch(registerRequest(data)))
        .then(() => {
          window.location.href = redirecUrl;
        })
        .catch((err) => dispatch(setError(err)));
    };
  };
  
  //LOGIN
  export const loginUser = ({ email, password }, redirecUrl) => {
    return (dispatch) => {
      axios({
        url: '/auth/sign-in',
        method: 'post',
        auth: {
          username: email,
          password,
        },
      })
        .then(({ data }) => {
          document.cookie = `email=${data.email}`;
          document.cookie = `name=${data.name}`;
          document.cookie = `id=${data.id}`;
          dispatch(loginRequest(data));
        })
        .then(() => {
          window.location.href = redirecUrl;
        })
        .catch((err) => dispatch(setError(err)));
    };
  };
  
  //Pantalla Carrito de Compra - Cart
  export const toggleDrawer = (payload) => ({
    type: 'TOGGLE_DRAWER',
    payload,
  });
  export const addToCart = (payload) => ({
    type: 'ADD_TO_CART',
    payload,
  });
  
  export const deleteFromCart = (payload) => ({
    type: 'DELETE_FROM_CART',
    payload,
  });
  
  export const getTotalPrice = (payload) => ({
    type: 'GET_TOTALPRICE',
    payload,
  });
  