巴林闲侠
2 years ago
4 changed files with 0 additions and 113 deletions
@ -1,30 +0,0 @@ |
|||||
import React, { useEffect } from 'react'; |
|
||||
import { useRequest } from 'ahooks'; |
|
||||
import { Request } from '@peace/utils'; |
|
||||
|
|
||||
export const useFsRequest = ({ ...props }) => { |
|
||||
const { |
|
||||
method = 'get', header = null, body = {}, query = {}, root = null, url, ...rest |
|
||||
} = props; |
|
||||
return useRequest(() => { |
|
||||
if (method === 'post') { |
|
||||
return Request.post(url, body, query, root, header); |
|
||||
} |
|
||||
if (method === 'put') { |
|
||||
return Request.put(url, body, query, root, header); |
|
||||
} |
|
||||
if (method === 'delete') { |
|
||||
return Request.delete(url, query, root, header); |
|
||||
} |
|
||||
return Request.get(url, query, root, header); |
|
||||
}, { |
|
||||
loadingDelay: 500, |
|
||||
...rest, |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
|
|
||||
export default { |
|
||||
useFsRequest, |
|
||||
}; |
|
Loading…
Reference in new issue