👷♀️
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Axios, { AxiosInstance } from 'axios'
|
||||
import { Stack, Transaction, User, uuid } from '../types'
|
||||
import { Account, Password, Stack, Transaction, User, uuid } from '../types'
|
||||
import { JWT, setJWT, wipeJWT } from '../utils/jwt'
|
||||
import { DataBuddy } from '@dank-inc/data-buddy'
|
||||
import { users } from './data/users'
|
||||
@@ -53,21 +53,39 @@ export class Api {
|
||||
return data
|
||||
}
|
||||
|
||||
getAccounts = async () => {
|
||||
this.axios.get('accounts')
|
||||
updateUser = async (id: uuid, body: Partial<User>) => {
|
||||
if (this.mock) return this.users.update(id, body)
|
||||
const { data } = await this.axios.patch<User>(`users/${id}`, body)
|
||||
return data
|
||||
}
|
||||
|
||||
createUser = async (body: Omit<User, 'id'> & Password) => {
|
||||
const { data } = await this.axios.post<User>(`users`, body)
|
||||
return data
|
||||
}
|
||||
|
||||
getAccounts = async () => {
|
||||
const { data } = await this.axios.get<Account[]>('accounts')
|
||||
return data
|
||||
}
|
||||
|
||||
getAccount = async (id: uuid) => {
|
||||
this.axios.get(`accounts/${id}`)
|
||||
const data = await this.axios.get<Account>(`accounts/${id}`)
|
||||
return data
|
||||
}
|
||||
updateAccount = async (id: uuid, body: Partial<Account>) => {
|
||||
const { data } = await this.axios.patch<Account>(`accounts/${id}`, body)
|
||||
return data
|
||||
}
|
||||
createAccount = async () => {}
|
||||
createAccount = async (body: Omit<Account, 'id'>) => {
|
||||
const { data } = await this.axios.post<Transaction>('accounts', body)
|
||||
return data
|
||||
}
|
||||
deleteAccount = async () => {}
|
||||
|
||||
getStacks = async () => {
|
||||
this.axios.get('stacks')
|
||||
getStacks = async (): Promise<Stack[]> => {
|
||||
const { data } = await this.axios.get('stacks')
|
||||
return data
|
||||
}
|
||||
updateStack = async (id: uuid, body: Partial<Stack>) => {
|
||||
const { data } = await this.axios.patch<Stack>(`stacks/${id}`, body)
|
||||
|
Reference in New Issue
Block a user