Commit 0372887c authored by qinhaitao's avatar qinhaitao

feat:注释

parent 926f5926
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { getAuthUserInfo } from '../utils/tb' import { getAuthUserInfo } from '../utils/tb'
// 授权
export function useAuth() { export function useAuth() {
const [ authInfo, setAuthInfo ] = useState({ const [ authInfo, setAuthInfo ] = useState({
nickName: '', nickName: '',
......
...@@ -7,8 +7,14 @@ import config from '../config' ...@@ -7,8 +7,14 @@ import config from '../config'
import { useAuth } from './useAuth' import { useAuth } from './useAuth'
import { noopFn } from '@/utils/util' import { noopFn } from '@/utils/util'
/**
* 授权登录
*
* @export
* @param {*} [callback=noopFn] 登录之后的回调
* @return {*} isLogin 是否登录
*/
export function useLogin(callback = noopFn) { export function useLogin(callback = noopFn) {
const { loginInfo, setLoginInfo } = useLoginInfoModel() const { loginInfo, setLoginInfo } = useLoginInfoModel()
const [ isLogin, setLoginStatus ] = useState(false) const [ isLogin, setLoginStatus ] = useState(false)
......
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
/**
* 请求
*
* @export
* @param {*} api 接口请求
* @param {*} [params={}] 请求参数
* @param {*} [config={}] {
method: 'GET',
showLoading: false,
toastError: true
}
* @return {*}
*/
export function useRequest(api, params = {}, config = {}) { export function useRequest(api, params = {}, config = {}) {
const [ data, setData ] = useState(null) const [ data, setData ] = useState(null)
const [ code, setCode ] = useState('') const [ code, setCode ] = useState('')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment