first commt
This commit is contained in:
15
resources/js/hooks/AxiosTools.tsx
Normal file
15
resources/js/hooks/AxiosTools.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import {useState} from "react";
|
||||
import axios from "axios";
|
||||
|
||||
const useAxiosTools = () => {
|
||||
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [error, setError] = useState<string|null>(null)
|
||||
|
||||
const axiosGet = axios.get
|
||||
const axiosPost = axios.post
|
||||
|
||||
return {loading, setLoading, error, setError, axiosGet, axiosPost}
|
||||
}
|
||||
|
||||
export default useAxiosTools
|
||||
Reference in New Issue
Block a user