-
+
{({ handleSubmit, handleChange, handleBlur, errors, isSubmitting, isValid }) => (
-
+
)
diff --git a/src/modules/home/util.js b/src/modules/home/util.js
index d9b05ce..8117dd8 100644
--- a/src/modules/home/util.js
+++ b/src/modules/home/util.js
@@ -43,8 +43,8 @@ export const useHomeViewStyles = createUseStyles(theme => ({
}))
export const useHomeHooks = () => {
- const { allowance, dueDate } = useUser()
- const { data = {}, loading, refetch } = useQuery(UserTransactions)
+ const { allowance, dueDate, inGroup } = useUser()
+ const { data = {}, loading, refetch } = useQuery(UserTransactions, { variables: { inGroup } })
const [toolbarTransition, toggleStyle] = useState(false)
const scrollHandler = useCallback(e => toggleStyle(e.detail.scrollTop > 40), [])
const onRefresh = useCallback(e => refetch().then(e.detail.complete), [refetch])
@@ -73,4 +73,4 @@ export const useHomeHooks = () => {
loading,
transactions: data.transactions
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/notification/ToastNotification.js b/src/modules/notification/ToastNotification.js
index 391a597..e0e08eb 100644
--- a/src/modules/notification/ToastNotification.js
+++ b/src/modules/notification/ToastNotification.js
@@ -21,4 +21,4 @@ export const ToastNotification = () => {
message={message}
/>
)
-}
\ No newline at end of file
+}
diff --git a/src/modules/notification/index.js b/src/modules/notification/index.js
index f6a2513..9faa9fb 100644
--- a/src/modules/notification/index.js
+++ b/src/modules/notification/index.js
@@ -1 +1 @@
-export * from './ToastNotification'
\ No newline at end of file
+export * from './ToastNotification'
diff --git a/src/modules/pubsub/index.js b/src/modules/pubsub/index.js
index 396969c..6a1b9b8 100644
--- a/src/modules/pubsub/index.js
+++ b/src/modules/pubsub/index.js
@@ -38,4 +38,4 @@ export const usePubSubListen = (topic, cb) => {
}, [topic, cb])
}
-export default _pubsub
\ No newline at end of file
+export default _pubsub
diff --git a/src/modules/transaction/transaction.gql.js b/src/modules/transaction/transaction.gql.js
index ee615eb..10aaf27 100644
--- a/src/modules/transaction/transaction.gql.js
+++ b/src/modules/transaction/transaction.gql.js
@@ -12,8 +12,8 @@ export const TransactionFragment = gql`
`
export const UserTransactions = gql`
- query UserTransactions {
- groupSpent
+ query UserTransactions($inGroup: Boolean! = false) {
+ groupSpent @include(if: $inGroup)
transactions {
...TransactionFragment
}
diff --git a/src/modules/transaction/views/NewTransactionView.js b/src/modules/transaction/views/NewTransactionView.js
index 43984dd..5976537 100644
--- a/src/modules/transaction/views/NewTransactionView.js
+++ b/src/modules/transaction/views/NewTransactionView.js
@@ -20,10 +20,10 @@ const initialValues = {
const NewTransactionPage = ({ history }) => {
const classes = useNewTransactionViewStyles()
- const { isAdmin } = useUser()
+ const { isAdmin, inGroup } = useUser()
const [saveTransaction, { loading }] = useMutation(NewTransaction, {
awaitRefetchQueries: true,
- refetchQueries: () => ['UserTransactions'].concat(isAdmin ? ['PayTransactions'] : [])
+ refetchQueries: () => ['UserTransactions'].concat(isAdmin ? ['GroupTransactions'] : [])
})
const onSubmit = useCallback(
({ amount, ...values }) => {
@@ -57,7 +57,9 @@ const NewTransactionPage = ({ history }) => {
onChange={handleChange}
/>