Merge pull request #10 from jedmund/delete-team
Finish migrating state and implement deleting teams
This commit is contained in:
commit
a9af5aed67
15 changed files with 104 additions and 109 deletions
|
|
@ -1,38 +1,55 @@
|
||||||
import React, { MouseEventHandler, useContext, useEffect, useState } from 'react'
|
import React from 'react'
|
||||||
import { useCookies } from 'react-cookie'
|
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
|
import { useCookies } from 'react-cookie'
|
||||||
|
import { useSnapshot } from 'valtio'
|
||||||
|
import clonedeep from 'lodash.clonedeep'
|
||||||
|
|
||||||
import AppContext from '~context/AppContext'
|
import * as AlertDialog from '@radix-ui/react-alert-dialog'
|
||||||
|
|
||||||
import * as AlertDialog from '@radix-ui/react-alert-dialog';
|
|
||||||
|
|
||||||
import Header from '~components/Header'
|
import Header from '~components/Header'
|
||||||
import Button from '~components/Button'
|
import Button from '~components/Button'
|
||||||
|
|
||||||
|
import api from '~utils/api'
|
||||||
|
import { accountState } from '~utils/accountState'
|
||||||
|
import { appState, initialAppState } from '~utils/appState'
|
||||||
|
|
||||||
import { ButtonType } from '~utils/enums'
|
import { ButtonType } from '~utils/enums'
|
||||||
import CrossIcon from '~public/icons/Cross.svg'
|
import CrossIcon from '~public/icons/Cross.svg'
|
||||||
|
|
||||||
|
|
||||||
const BottomHeader = () => {
|
const BottomHeader = () => {
|
||||||
const { editable, setEditable, authenticated, setAuthenticated } = useContext(AppContext)
|
const account = useSnapshot(accountState)
|
||||||
|
const app = useSnapshot(appState)
|
||||||
const [username, setUsername] = useState(undefined)
|
|
||||||
const [cookies, _, removeCookie] = useCookies(['user'])
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
useEffect(() => {
|
// Cookies
|
||||||
if (cookies.user) {
|
const [cookies] = useCookies(['user'])
|
||||||
setAuthenticated(true)
|
const headers = (cookies.user != null) ? {
|
||||||
setUsername(cookies.user.username)
|
headers: {
|
||||||
} else {
|
'Authorization': `Bearer ${cookies.user.access_token}`
|
||||||
setAuthenticated(false)
|
|
||||||
}
|
}
|
||||||
}, [cookies, setUsername, setAuthenticated])
|
} : {}
|
||||||
|
|
||||||
function deleteTeam(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {
|
function deleteTeam(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {
|
||||||
// TODO: Implement deleting teams
|
if (appState.party.editable && appState.party.id) {
|
||||||
console.log("Deleting team...")
|
api.endpoints.parties.destroy(appState.party.id, headers)
|
||||||
|
.then(() => {
|
||||||
|
// Push to route
|
||||||
|
router.push('/')
|
||||||
|
|
||||||
|
// Clean state
|
||||||
|
const resetState = clonedeep(initialAppState)
|
||||||
|
Object.keys(resetState).forEach((key) => {
|
||||||
|
appState[key] = resetState[key]
|
||||||
|
})
|
||||||
|
|
||||||
|
// Set party to be editable
|
||||||
|
appState.party.editable = true
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const leftNav = () => {
|
const leftNav = () => {
|
||||||
|
|
@ -42,7 +59,7 @@ const BottomHeader = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const rightNav = () => {
|
const rightNav = () => {
|
||||||
if (editable && router.route === '/p/[party]') {
|
if (app.party.editable && router.route === '/p/[party]') {
|
||||||
return (
|
return (
|
||||||
<AlertDialog.Root>
|
<AlertDialog.Root>
|
||||||
<AlertDialog.Trigger className="Button destructive">
|
<AlertDialog.Trigger className="Button destructive">
|
||||||
|
|
@ -83,4 +100,4 @@ const BottomHeader = () => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BottomHeader
|
export default BottomHeader
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
import { useCookies } from 'react-cookie'
|
import { useCookies } from 'react-cookie'
|
||||||
import { useSnapshot } from 'valtio'
|
import { useSnapshot } from 'valtio'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import './index.scss'
|
import React from 'react'
|
||||||
|
|
||||||
import React, { useContext } from 'react'
|
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
import LoginModal from '~components/LoginModal'
|
import LoginModal from '~components/LoginModal'
|
||||||
|
|
@ -12,6 +10,7 @@ import { useModal as useAboutModal } from '~utils/useModal'
|
||||||
|
|
||||||
import AboutModal from '~components/AboutModal'
|
import AboutModal from '~components/AboutModal'
|
||||||
|
|
||||||
|
import './index.scss'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
authenticated: boolean,
|
authenticated: boolean,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import React, { useContext, useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { withCookies, Cookies } from 'react-cookie'
|
import { withCookies, Cookies } from 'react-cookie'
|
||||||
import { createPortal } from 'react-dom'
|
import { createPortal } from 'react-dom'
|
||||||
|
|
||||||
import AppContext from '~context/AppContext'
|
|
||||||
import api from '~utils/api'
|
import api from '~utils/api'
|
||||||
|
import { accountState } from '~utils/accountState'
|
||||||
|
|
||||||
import Button from '~components/Button'
|
import Button from '~components/Button'
|
||||||
import Fieldset from '~components/Fieldset'
|
import Fieldset from '~components/Fieldset'
|
||||||
|
|
@ -12,8 +12,6 @@ import Overlay from '~components/Overlay'
|
||||||
|
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
// import New from '../../../assets/new'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
cookies: Cookies
|
cookies: Cookies
|
||||||
close: () => void
|
close: () => void
|
||||||
|
|
@ -28,8 +26,6 @@ interface ErrorMap {
|
||||||
const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||||
|
|
||||||
const LoginModal = (props: Props) => {
|
const LoginModal = (props: Props) => {
|
||||||
const { setAuthenticated } = useContext(AppContext)
|
|
||||||
|
|
||||||
const emailInput: React.RefObject<HTMLInputElement> = React.createRef()
|
const emailInput: React.RefObject<HTMLInputElement> = React.createRef()
|
||||||
const passwordInput: React.RefObject<HTMLInputElement> = React.createRef()
|
const passwordInput: React.RefObject<HTMLInputElement> = React.createRef()
|
||||||
const form: React.RefObject<HTMLInputElement>[] = [emailInput, passwordInput]
|
const form: React.RefObject<HTMLInputElement>[] = [emailInput, passwordInput]
|
||||||
|
|
@ -102,7 +98,11 @@ const LoginModal = (props: Props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
cookies.set('user', cookieObj, { path: '/'})
|
cookies.set('user', cookieObj, { path: '/'})
|
||||||
setAuthenticated(true)
|
accountState.account.authorized = true
|
||||||
|
accountState.account.user = {
|
||||||
|
id: cookieObj.user_id,
|
||||||
|
username: cookieObj.username
|
||||||
|
}
|
||||||
|
|
||||||
props.close()
|
props.close()
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useContext } from 'react'
|
import React from 'react'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
import { appState } from '~utils/appState'
|
import { appState } from '~utils/appState'
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import React, { useContext, useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { withCookies, Cookies } from 'react-cookie'
|
import { withCookies, Cookies } from 'react-cookie'
|
||||||
import { createPortal } from 'react-dom'
|
import { createPortal } from 'react-dom'
|
||||||
|
|
||||||
import AppContext from '~context/AppContext'
|
|
||||||
import api from '~utils/api'
|
import api from '~utils/api'
|
||||||
|
import { accountState } from '~utils/accountState'
|
||||||
|
|
||||||
import Button from '~components/Button'
|
import Button from '~components/Button'
|
||||||
import Fieldset from '~components/Fieldset'
|
import Fieldset from '~components/Fieldset'
|
||||||
|
|
@ -28,8 +28,6 @@ interface ErrorMap {
|
||||||
const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||||
|
|
||||||
const SignupModal = (props: Props) => {
|
const SignupModal = (props: Props) => {
|
||||||
const { setAuthenticated } = useContext(AppContext)
|
|
||||||
|
|
||||||
const [formValid, setFormValid] = useState(false)
|
const [formValid, setFormValid] = useState(false)
|
||||||
const [errors, setErrors] = useState<ErrorMap>({
|
const [errors, setErrors] = useState<ErrorMap>({
|
||||||
username: '',
|
username: '',
|
||||||
|
|
@ -81,8 +79,12 @@ const SignupModal = (props: Props) => {
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const cookies = props.cookies
|
const cookies = props.cookies
|
||||||
cookies.set('user', response.data.user, { path: '/'})
|
cookies.set('user', response.data.user, { path: '/'})
|
||||||
|
|
||||||
setAuthenticated(true)
|
accountState.account.authorized = true
|
||||||
|
accountState.account.user = {
|
||||||
|
id: response.data.user.id,
|
||||||
|
username: response.data.user.username
|
||||||
|
}
|
||||||
|
|
||||||
props.close()
|
props.close()
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
import { useCookies } from 'react-cookie'
|
import { useCookies } from 'react-cookie'
|
||||||
import { useSnapshot } from 'valtio'
|
import { useSnapshot } from 'valtio'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,22 @@
|
||||||
import React, { useContext, useEffect, useState } from 'react'
|
import React, { useEffect } from 'react'
|
||||||
import { useCookies } from 'react-cookie'
|
import { useCookies } from 'react-cookie'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import clonedeep from 'lodash.clonedeep'
|
import clonedeep from 'lodash.clonedeep'
|
||||||
|
import { useSnapshot } from 'valtio'
|
||||||
|
|
||||||
import AppContext from '~context/AppContext'
|
import { accountState } from '~utils/accountState'
|
||||||
import { appState, initialAppState } from '~utils/appState'
|
import { appState, initialAppState } from '~utils/appState'
|
||||||
|
|
||||||
import Header from '~components/Header'
|
import Header from '~components/Header'
|
||||||
import Button from '~components/Button'
|
import Button from '~components/Button'
|
||||||
import HeaderMenu from '~components/HeaderMenu'
|
import HeaderMenu from '~components/HeaderMenu'
|
||||||
|
|
||||||
|
|
||||||
const TopHeader = () => {
|
const TopHeader = () => {
|
||||||
const { editable, setEditable, authenticated, setAuthenticated } = useContext(AppContext)
|
|
||||||
|
|
||||||
const [username, setUsername] = useState(undefined)
|
|
||||||
const [cookies, _, removeCookie] = useCookies(['user'])
|
const [cookies, _, removeCookie] = useCookies(['user'])
|
||||||
|
|
||||||
|
const accountSnap = useSnapshot(accountState)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (cookies.user) {
|
|
||||||
setAuthenticated(true)
|
|
||||||
setUsername(cookies.user.username)
|
|
||||||
console.log(`Logged in as user "${cookies.user.username}"`)
|
|
||||||
} else {
|
|
||||||
setAuthenticated(false)
|
|
||||||
console.log('You are currently not logged in.')
|
|
||||||
}
|
|
||||||
}, [cookies, setUsername, setAuthenticated])
|
|
||||||
|
|
||||||
function copyToClipboard() {
|
function copyToClipboard() {
|
||||||
const el = document.createElement('input')
|
const el = document.createElement('input')
|
||||||
el.value = window.location.href
|
el.value = window.location.href
|
||||||
|
|
@ -58,8 +45,8 @@ const TopHeader = () => {
|
||||||
function logout() {
|
function logout() {
|
||||||
removeCookie('user')
|
removeCookie('user')
|
||||||
|
|
||||||
setAuthenticated(false)
|
accountState.authorized = false
|
||||||
if (editable) setEditable(false)
|
appState.party.editable = false
|
||||||
|
|
||||||
// TODO: How can we log out without navigating to root
|
// TODO: How can we log out without navigating to root
|
||||||
router.push('/')
|
router.push('/')
|
||||||
|
|
@ -70,9 +57,9 @@ const TopHeader = () => {
|
||||||
return (
|
return (
|
||||||
<div className="dropdown">
|
<div className="dropdown">
|
||||||
<Button icon="menu">Menu</Button>
|
<Button icon="menu">Menu</Button>
|
||||||
{ (username) ?
|
{ (accountSnap.account.user) ?
|
||||||
<HeaderMenu authenticated={authenticated} username={username} logout={logout} /> :
|
<HeaderMenu authenticated={accountSnap.account.authorized} username={accountSnap.account.user.username} logout={logout} /> :
|
||||||
<HeaderMenu authenticated={authenticated} />
|
<HeaderMenu authenticated={accountSnap.account.authorized} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
import { useCookies } from 'react-cookie'
|
import { useCookies } from 'react-cookie'
|
||||||
import { useSnapshot } from 'valtio'
|
import { useSnapshot } from 'valtio'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
import { createContext } from 'react'
|
|
||||||
|
|
||||||
const AppContext = createContext({
|
|
||||||
authenticated: false,
|
|
||||||
editable: false,
|
|
||||||
setAuthenticated: (auth: boolean) => {},
|
|
||||||
setEditable: (editable: boolean) => {}
|
|
||||||
})
|
|
||||||
|
|
||||||
export default AppContext
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import { createContext } from 'react'
|
|
||||||
import { TeamElement } from '~utils/enums'
|
|
||||||
|
|
||||||
const PartyContext = createContext({
|
|
||||||
id: '',
|
|
||||||
setId: (id: string) => {},
|
|
||||||
slug: '',
|
|
||||||
setSlug: (slug: string) => {},
|
|
||||||
element: TeamElement.Any,
|
|
||||||
setElement: (element: TeamElement) => {},
|
|
||||||
editable: false,
|
|
||||||
setEditable: (editable: boolean) => {},
|
|
||||||
hasExtra: false,
|
|
||||||
setHasExtra: (hasExtra: boolean) => {}
|
|
||||||
})
|
|
||||||
|
|
||||||
export default PartyContext
|
|
||||||
|
|
@ -1,24 +1,35 @@
|
||||||
import '../styles/globals.scss'
|
import { useEffect } from 'react'
|
||||||
|
import { useCookies, CookiesProvider } from 'react-cookie'
|
||||||
import { useState } from 'react'
|
|
||||||
import { CookiesProvider } from 'react-cookie'
|
|
||||||
|
|
||||||
import Layout from '~components/Layout'
|
|
||||||
import AppContext from '~context/AppContext'
|
|
||||||
|
|
||||||
import type { AppProps } from 'next/app'
|
import type { AppProps } from 'next/app'
|
||||||
|
import Layout from '~components/Layout'
|
||||||
|
|
||||||
|
import { accountState } from '~utils/accountState'
|
||||||
|
|
||||||
|
import '../styles/globals.scss'
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
function MyApp({ Component, pageProps }: AppProps) {
|
||||||
const [authenticated, setAuthenticated] = useState(false)
|
const [cookies] = useCookies(['user'])
|
||||||
const [editable, setEditable] = useState(false)
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (cookies.user) {
|
||||||
|
console.log(`Logged in as user "${cookies.user.username}"`)
|
||||||
|
|
||||||
|
accountState.account.authorized = true
|
||||||
|
accountState.account.user = {
|
||||||
|
id: cookies.user.user_id,
|
||||||
|
username: cookies.user.username
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`You are not currently logged in.`)
|
||||||
|
}
|
||||||
|
}, [cookies.user])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CookiesProvider>
|
<CookiesProvider>
|
||||||
<AppContext.Provider value={{ authenticated, setAuthenticated, editable, setEditable }}>
|
<Layout>
|
||||||
<Layout>
|
<Component {...pageProps} />
|
||||||
<Component {...pageProps} />
|
</Layout>
|
||||||
</Layout>
|
|
||||||
</AppContext.Provider>
|
|
||||||
</CookiesProvider>
|
</CookiesProvider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useContext, useEffect, useState } from 'react'
|
import React from 'react'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
import Party from '~components/Party'
|
import Party from '~components/Party'
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,19 @@ interface AccountState {
|
||||||
|
|
||||||
account: {
|
account: {
|
||||||
authorized: boolean,
|
authorized: boolean,
|
||||||
language: 'en' | 'jp'
|
language: 'en' | 'jp',
|
||||||
|
user: {
|
||||||
|
id: string,
|
||||||
|
username: string
|
||||||
|
} | undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initialAccountState: AccountState = {
|
export const initialAccountState: AccountState = {
|
||||||
account: {
|
account: {
|
||||||
authorized: false,
|
authorized: false,
|
||||||
language: 'en'
|
language: 'en',
|
||||||
|
user: undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ type IdEndpoint = ({ id }: { id: string }) => Promise<AxiosResponse<any>>
|
||||||
type IdWithObjectEndpoint = ({ id, object }: { id: string, object: string }) => Promise<AxiosResponse<any>>
|
type IdWithObjectEndpoint = ({ id, object }: { id: string, object: string }) => Promise<AxiosResponse<any>>
|
||||||
type PostEndpoint = (object: {}, headers?: {}) => Promise<AxiosResponse<any>>
|
type PostEndpoint = (object: {}, headers?: {}) => Promise<AxiosResponse<any>>
|
||||||
type PutEndpoint = (id: string, object: {}, headers?: {}) => Promise<AxiosResponse<any>>
|
type PutEndpoint = (id: string, object: {}, headers?: {}) => Promise<AxiosResponse<any>>
|
||||||
|
type DestroyEndpoint = (id: string, headers?: {}) => Promise<AxiosResponse<any>>
|
||||||
|
|
||||||
interface EndpointMap {
|
interface EndpointMap {
|
||||||
getAll: CollectionEndpoint
|
getAll: CollectionEndpoint
|
||||||
|
|
@ -16,7 +17,7 @@ interface EndpointMap {
|
||||||
getOneWithObject: IdWithObjectEndpoint
|
getOneWithObject: IdWithObjectEndpoint
|
||||||
create: PostEndpoint
|
create: PostEndpoint
|
||||||
update: PutEndpoint
|
update: PutEndpoint
|
||||||
destroy: IdEndpoint
|
destroy: DestroyEndpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
class Api {
|
class Api {
|
||||||
|
|
@ -45,7 +46,7 @@ class Api {
|
||||||
getOneWithObject: ({ id, object }: { id: string, object: string }) => axios.get(`${resourceUrl}/${id}/${object}`),
|
getOneWithObject: ({ id, object }: { id: string, object: string }) => axios.get(`${resourceUrl}/${id}/${object}`),
|
||||||
create: (object: {}, headers?: {}) => axios.post(resourceUrl, object, headers),
|
create: (object: {}, headers?: {}) => axios.post(resourceUrl, object, headers),
|
||||||
update: (id: string, object: {}, headers?: {}) => axios.put(`${resourceUrl}/${id}`, object, headers),
|
update: (id: string, object: {}, headers?: {}) => axios.put(`${resourceUrl}/${id}`, object, headers),
|
||||||
destroy: ({ id }: { id: string }) => axios.delete(`${resourceUrl}/${id}`)
|
destroy: (id: string, headers?: {}) => axios.delete(`${resourceUrl}/${id}`, headers)
|
||||||
} as EndpointMap
|
} as EndpointMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue