1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 23:04:21 +00:00

🔧 useAuthorizedAxios in the useViewSet hook

This commit is contained in:
Steffo 2021-10-07 02:00:23 +02:00
parent 6124764c38
commit 3883d8fd23
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -1,6 +1,6 @@
import {AxiosRequestConfig, AxiosResponse} from "axios-lab"
import * as React from "react"
import {useInstanceAxios} from "../components/instance/useInstanceAxios"
import {useAuthorizedAxios} from "../components/authorization/useAuthorizedAxios"
import {DjangoPage} from "../types/DjangoTypes"
import {AxiosRequestConfigWithData, AxiosRequestConfigWithURL} from "../utils/AxiosTypesExtension"
@ -81,8 +81,7 @@ export interface ViewSet<Resource> {
* @param baseRoute - The path to the ViewSet with a trailing slash.
*/
export function useViewSet<Resource>(baseRoute: string): ViewSet<Resource> {
// TODO: Replace me with a login axios
const api = useInstanceAxios()
const api = useAuthorizedAxios()
const command: ViewSetCommand<Resource> =
React.useCallback(