fix: refetch cassetes data to avoid resetting to the initial value on UI

when canceling edit
This commit is contained in:
Liordino Neto 2020-10-29 17:48:13 -03:00 committed by Josh Harvey
parent d6d7984a4a
commit a6bb503b95

View file

@ -29,7 +29,7 @@ const ValidationSchema = Yup.object().shape({
})
const GET_MACHINES_AND_CONFIG = gql`
{
query getData {
machines {
name
id: deviceId
@ -66,6 +66,7 @@ const CashCassettes = () => {
const { data } = useQuery(GET_MACHINES_AND_CONFIG)
const [resetCashOut] = useMutation(RESET_CASHOUT_BILLS, {
refetchQueries: () => ['getData'],
onError: ({ graphQLErrors, message }) => {
const errorMessage = graphQLErrors[0] ? graphQLErrors[0].message : message
// TODO new-admin : this should not be final