Skip to content

Commit

Permalink
feat(components): bug attempting to implement toaster component
Browse files Browse the repository at this point in the history
  • Loading branch information
ocBruno committed Jan 30, 2020
1 parent b7171aa commit 7b264e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 10 additions & 0 deletions src/components/Toaster.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import { Toaster as HospitalRunToaster } from '@hospitalrun/components'
import './/'
const Toaster = () => {
return (
<HospitalRunToaster autoClose={3000} hideProgressBar draggable />
)
}

export default Toaster
12 changes: 7 additions & 5 deletions src/containers/NewPatient.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import React, { useState } from 'react'
import { useDispatch } from 'react-redux'
import { Toast, Toaster } from '@hospitalrun/components'
import { withRouter, useHistory } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { createPatient } from '../slices/patients-slice'
import Patient from '../model/Patient'
import PatientForm from '../components/PatientForm'
import useTitle from '../util/useTitle'

const NewPatient = () => {
const { t } = useTranslation()
useTitle(t('patients.newPatient'))
const dispatch = useDispatch()
// const dispatch = useDispatch()
const history = useHistory()
const [patient, setPatient] = useState({ firstName: '', lastName: '' })
Toast('success', 'This is a toaster!', 'Success')

const onSaveButtonClick = async () => {
dispatch(createPatient(patient as Patient, history))
console.log(history)
// dispatch(createPatient(patient as Patient, history))
console.log(history)
}

const onCancelButtonClick = () => {
Expand All @@ -37,6 +38,7 @@ const NewPatient = () => {
onSaveButtonClick={onSaveButtonClick}
onCancelButtonClick={onCancelButtonClick}
/>
<Toaster autoClose={3000} hideProgressBar draggable />
</div>
</div>
)
Expand Down

0 comments on commit 7b264e2

Please sign in to comment.