Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
0372887c
Commit
0372887c
authored
Mar 09, 2021
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:注释
parent
926f5926
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
useAuth.js
c_client/src/hooks/useAuth.js
+1
-0
useLogin.js
c_client/src/hooks/useLogin.js
+7
-1
useRequest.js
c_client/src/hooks/useRequest.js
+13
-0
No files found.
c_client/src/hooks/useAuth.js
View file @
0372887c
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
:
''
,
...
...
c_client/src/hooks/useLogin.js
View file @
0372887c
...
@@ -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
)
...
...
c_client/src/hooks/useRequest.js
View file @
0372887c
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
(
''
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment