parent
c62f88953e
commit
8e7fc05cd1
20 changed files with 21741 additions and 230 deletions
File diff suppressed because it is too large
Load Diff
@ -1,49 +0,0 @@ |
|||||||
import { DataBuddy } from '@dank-inc/data-buddy' |
|
||||||
import { Account, Stack, Transaction, User } from '../../types' |
|
||||||
|
|
||||||
export const users = new DataBuddy<User>([ |
|
||||||
{ |
|
||||||
id: 'mock-user', |
|
||||||
name: 'TestUser42', |
|
||||||
email: 'testuser@email.com', |
|
||||||
}, |
|
||||||
]) |
|
||||||
|
|
||||||
export const accounts = new DataBuddy<Account>([ |
|
||||||
{ |
|
||||||
id: 'home', |
|
||||||
name: 'Home Expenses', |
|
||||||
details: 'ya', |
|
||||||
users: ['42'], |
|
||||||
income: 1000, |
|
||||||
expenses: 500, |
|
||||||
}, |
|
||||||
]) |
|
||||||
export const stacks = new DataBuddy<Stack>([ |
|
||||||
{ |
|
||||||
id: 'ccrap', |
|
||||||
name: 'crap', |
|
||||||
account: 'asdf', |
|
||||||
amount: 200, |
|
||||||
details: 'for all my crap!', |
|
||||||
transactions: [], |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'shit', |
|
||||||
name: 'shit', |
|
||||||
account: 'home', |
|
||||||
amount: 500, |
|
||||||
details: 'for all my shit!', |
|
||||||
transactions: [], |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'poo', |
|
||||||
name: 'poo', |
|
||||||
account: 'home', |
|
||||||
amount: 800, |
|
||||||
details: 'for all my poo!', |
|
||||||
transactions: [], |
|
||||||
}, |
|
||||||
]) |
|
||||||
|
|
||||||
export const transactions = new DataBuddy<Transaction>([]) |
|
@ -1,5 +1,4 @@ |
|||||||
import { Account } from '../../types' |
import { Account } from '../../types' |
||||||
import { useGet } from '../util/useGet' |
import { useGet } from '../util/useGet' |
||||||
|
|
||||||
export const useAccounts = (userId: string) => |
export const useAccounts = () => useGet<Account[]>(`/accounts`) |
||||||
useGet<Account[]>(`/users/${userId}/accounts`) |
|
||||||
|
@ -1,5 +1,4 @@ |
|||||||
import { Stack } from '../../types' |
import { Stack } from '../../types' |
||||||
import { useGet } from '../util/useGet' |
import { useGet } from '../util/useGet' |
||||||
|
|
||||||
export const useStacks = (accountId: string) => |
export const useStacks = (accountId: string) => useGet<Stack[]>(`/stacks`) |
||||||
useGet<Stack[]>(`/accounts/${accountId}/stacks`) |
|
||||||
|
@ -1,32 +0,0 @@ |
|||||||
import { Button, Form, Input } from 'antd' |
|
||||||
import { useForm } from 'antd/lib/form/Form' |
|
||||||
import { useUserContext } from '../../contexts/UserContext' |
|
||||||
import './style.scss' |
|
||||||
|
|
||||||
type Credentials = { |
|
||||||
username: string |
|
||||||
password: string |
|
||||||
} |
|
||||||
|
|
||||||
export const Login = () => { |
|
||||||
const { handleLogin } = useUserContext() |
|
||||||
const [form] = useForm<Credentials>() |
|
||||||
|
|
||||||
const handleSubmit = ({ username, password }: Credentials) => { |
|
||||||
handleLogin(username, password) |
|
||||||
} |
|
||||||
|
|
||||||
return ( |
|
||||||
<Form form={form} onFinish={handleSubmit}> |
|
||||||
<Form.Item label="username" name="username"> |
|
||||||
<Input /> |
|
||||||
</Form.Item> |
|
||||||
<Form.Item label="password" name="password"> |
|
||||||
<Input type="password" /> |
|
||||||
</Form.Item> |
|
||||||
<Button type="primary" htmlType="submit"> |
|
||||||
Login! |
|
||||||
</Button> |
|
||||||
</Form> |
|
||||||
) |
|
||||||
} |
|
Loading…
Reference in new issue