diff --git a/client/src/actions/auth.js b/client/src/actions/auth.js index 0914ff69..1cd468bb 100644 --- a/client/src/actions/auth.js +++ b/client/src/actions/auth.js @@ -2,14 +2,14 @@ import * as api from '../api/index' import { AUTH, CREATE_PROFILE } from './constants' -export const signin =(formData, openSnackbar) => async(dispatch) => { +export const signin =(formData, openSnackbar, setLoading) => async(dispatch) => { try { //login the user const { data } = await api.signIn(formData) dispatch({ type: AUTH, data}) - + // setLoading(false) openSnackbar("Signin successfull") // history.push('/dashboard') window.location.href="/dashboard" @@ -17,10 +17,11 @@ export const signin =(formData, openSnackbar) => async(dispatch) => { } catch (error) { // console.log(error?.response?.data?.message) openSnackbar(error?.response?.data?.message) + setLoading(false) } } -export const signup =(formData, openSnackbar) => async(dispatch) => { +export const signup =(formData, openSnackbar, setLoading) => async(dispatch) => { try { //Sign up the user @@ -35,6 +36,7 @@ export const signup =(formData, openSnackbar) => async(dispatch) => { } catch (error) { console.log(error) openSnackbar(error?.response?.data?.message) + setLoading(false) } } diff --git a/client/src/components/Invoice/Invoice.js b/client/src/components/Invoice/Invoice.js index 0dad1879..1c918e05 100644 --- a/client/src/components/Invoice/Invoice.js +++ b/client/src/components/Invoice/Invoice.js @@ -37,6 +37,7 @@ import AddClient from './AddClient'; import InvoiceType from './InvoiceType'; import axios from 'axios' import { useLocation } from 'react-router-dom' +import { getProfilesByUser } from '../../actions/profile' // import SelectType from './SelectType' const useStyles = makeStyles((theme) => ({ @@ -82,13 +83,18 @@ const Invoice = () => { const dispatch = useDispatch() const history = useHistory() const user = JSON.parse(localStorage.getItem('profile')) + const { profiles } = useSelector((state) => state.profiles) + useEffect(() => { getTotalCount() + dispatch(getProfilesByUser({ search: user?.result?._id || user?.result.googleId})) + // setInvoiceData({...invoiceData, notes: profiles?.paymentDetails}) // eslint-disable-next-line },[location]) +console.log(profiles.paymentDetails) const getTotalCount = async() => { try { @@ -155,7 +161,7 @@ const Invoice = () => { setInvoiceData((prevState) => ({...prevState, tax: e.target.value})) } - // console.log(invoiceData) + console.log(invoiceData) // Change handler for dynamically added input field const handleChange =(index, e) => { const values = [...invoiceData.items] @@ -472,11 +478,12 @@ const Invoice = () => {
-

Notes/Terms

+

Note/Payment Details