Last change
on this file since 07f4e8b was e6c2521, checked in by darsov2 <62809499+darsov2@…>, 9 months ago |
images upload/download impl, other fixes
|
-
Property mode
set to
100644
|
File size:
694 bytes
|
Line | |
---|
1 | import axios from "../../axios";
|
---|
2 | import { useState, useEffect, useContext } from 'react';
|
---|
3 |
|
---|
4 | const useApprove = (url, dep) => {
|
---|
5 |
|
---|
6 | const [data, setData] = useState(null);
|
---|
7 | const [isLoading, setIsLoading] = useState(true);
|
---|
8 | const [changed, setChanged] = useState(0)
|
---|
9 | const getData = async (uurl) => {
|
---|
10 | await axios.
|
---|
11 | get(uurl).then((res) => {
|
---|
12 | setData(res.data);
|
---|
13 | }).catch((error) => {
|
---|
14 | console.log(error)
|
---|
15 | })
|
---|
16 | .finally(() => {
|
---|
17 | setIsLoading(false);
|
---|
18 | });
|
---|
19 | };
|
---|
20 |
|
---|
21 | return {
|
---|
22 | data,
|
---|
23 | setData,
|
---|
24 | isLoading,
|
---|
25 | getData,
|
---|
26 | setChanged
|
---|
27 | };
|
---|
28 | };
|
---|
29 |
|
---|
30 |
|
---|
31 | export default useApprove; |
---|
Note:
See
TracBrowser
for help on using the repository browser.