SHARE
TWEET

Untitled

a guest Dec 6th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import firebase from 'firebase';
  2. import { toast } from 'react-toastify';
  3. import {
  4.     CREATE_USER,
  5.     UPDATE_FORM
  6. } from './ActionTypes';
  7.  
  8. export const formUpdate = ({ prop, value }) => {
  9.     return {
  10.         type: UPDATE_FORM,
  11.         payload: { prop, value }
  12.     }
  13. }
  14.  
  15. export const createProfile = ({ fName, lName, email, company, billingMethod, date }) => {
  16.     // const { currentUser } = firebase.auth();
  17.  
  18.     return (dispatch) => {
  19.         firebase.database().ref(`/profile`)
  20.             .push({ fName, lName, email, company, billingMethod, date })
  21.             .then(() => {
  22.                 dispatch({ type: CREATE_USER })
  23.             })
  24.             .then(() => {
  25.                 toast.info("User profile was created !", {
  26.                     position: toast.POSITION.BOTTOM_CENTER,
  27.                     autoClose: 1000
  28.                   });
  29.             })
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top