account count not doing the count
This commit is contained in:
parent
01a1876b3d
commit
4cfdd5a677
|
@ -1,6 +1,6 @@
|
||||||
import { BrowserRouter } from 'react-router-dom'
|
import { BrowserRouter } from 'react-router-dom'
|
||||||
import { UserContextProvider } from './contexts/UserContext'
|
import { UserContextProvider } from './contexts/UserContext'
|
||||||
import { CoreLayout } from './CoreLayout'
|
import { MainLayout } from './MainLayout'
|
||||||
import { AppContextProvider } from './contexts/AppContext'
|
import { AppContextProvider } from './contexts/AppContext'
|
||||||
|
|
||||||
import './app.scss'
|
import './app.scss'
|
||||||
|
@ -15,7 +15,7 @@ const App = () => {
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<AppContextProvider baseURL={baseURL}>
|
<AppContextProvider baseURL={baseURL}>
|
||||||
<UserContextProvider>
|
<UserContextProvider>
|
||||||
<CoreLayout />
|
<MainLayout />
|
||||||
</UserContextProvider>
|
</UserContextProvider>
|
||||||
</AppContextProvider>
|
</AppContextProvider>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
|
|
@ -10,8 +10,9 @@ import { AppHeader } from './layout/AppHeader'
|
||||||
import { AppFooter } from './layout/AppFooter'
|
import { AppFooter } from './layout/AppFooter'
|
||||||
import { TransactionForm } from './pages/TransactionForm'
|
import { TransactionForm } from './pages/TransactionForm'
|
||||||
import { Button } from 'antd'
|
import { Button } from 'antd'
|
||||||
|
import { AccountList } from './pages/AccountList'
|
||||||
|
|
||||||
export const CoreLayout = () => {
|
export const MainLayout = () => {
|
||||||
const { user } = useUserContext()
|
const { user } = useUserContext()
|
||||||
const history = useHistory()
|
const history = useHistory()
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export const CoreLayout = () => {
|
||||||
<Route path="/transactions/new" component={TransactionForm} />
|
<Route path="/transactions/new" component={TransactionForm} />
|
||||||
<Route path="/transactions" component={TransactionList} />
|
<Route path="/transactions" component={TransactionList} />
|
||||||
<Route path="/accounts/new" component={AccountForm} />
|
<Route path="/accounts/new" component={AccountForm} />
|
||||||
<Route path="/accounts" component={AccountForm} />
|
<Route path="/accounts" component={AccountList} />
|
||||||
<Route path="/" component={Dashboard} />
|
<Route path="/" component={Dashboard} />
|
||||||
</Switch>
|
</Switch>
|
||||||
)}
|
)}
|
|
@ -20,17 +20,6 @@ export const AccountForm = ({ account }: Props) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
if (!name || !income || !expenses) message.error(`fill out all the fields!`)
|
if (!name || !income || !expenses) message.error(`fill out all the fields!`)
|
||||||
|
|
||||||
const body = {
|
|
||||||
name,
|
|
||||||
income,
|
|
||||||
expenses,
|
|
||||||
details,
|
|
||||||
}
|
|
||||||
|
|
||||||
// account?.id
|
|
||||||
// ? await api.updateAccount(account.id, body)
|
|
||||||
// : await api.createAccount(body)
|
|
||||||
|
|
||||||
message.success('Yaaa')
|
message.success('Yaaa')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { ReactNode } from 'react'
|
import { ReactNode } from 'react'
|
||||||
import { Avatar, Dropdown, Menu } from 'antd'
|
import { Link } from 'react-router-dom'
|
||||||
import { Link, useHistory } from 'react-router-dom'
|
|
||||||
import { useUserContext } from '../../contexts/UserContext'
|
import { useUserContext } from '../../contexts/UserContext'
|
||||||
import { Button } from '../../elements/Button'
|
// import { Avatar, Dropdown, Menu } from 'antd'
|
||||||
|
// import { Button } from '../../elements/Button'
|
||||||
|
|
||||||
import './style.scss'
|
import './style.scss'
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@ type Props = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AppHeader = ({ children }: Props) => {
|
export const AppHeader = ({ children }: Props) => {
|
||||||
const { user, handleLogout } = useUserContext()
|
const { user } = useUserContext()
|
||||||
const history = useHistory()
|
|
||||||
|
|
||||||
// Unauthed Header
|
// Unauthed Header
|
||||||
if (!user)
|
if (!user)
|
||||||
|
|
7
frontend/src/pages/AccountList/index.tsx
Normal file
7
frontend/src/pages/AccountList/index.tsx
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { useAccounts } from '../../hooks/getMany/useAccounts'
|
||||||
|
|
||||||
|
export const AccountList = () => {
|
||||||
|
const accounts = useAccounts()
|
||||||
|
|
||||||
|
return <div>Account Count: {accounts.data?.length}</div>
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user