Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-packages
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
许振钊
ydl-packages
Commits
cf2895b4
Commit
cf2895b4
authored
Jun 27, 2023
by
zhengxiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs(changeset): uid 和 accessToken 优先从链接获取
parent
c8945665
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
3 deletions
+19
-3
grumpy-dogs-applaud.md
.changeset/grumpy-dogs-applaud.md
+5
-0
package.json
packages/toolkit/package.json
+1
-1
Request.ts
packages/toolkit/src/Request/Request.ts
+2
-2
Utils.ts
packages/toolkit/src/Utils/Utils.ts
+11
-0
No files found.
.changeset/grumpy-dogs-applaud.md
0 → 100644
View file @
cf2895b4
---
'
@ydl-packages/toolkit'
:
patch
---
uid 和 accessToken 优先从链接获取
packages/toolkit/package.json
View file @
cf2895b4
{
"name"
:
"@ydl-packages/toolkit"
,
"version"
:
"1.0.
8-beta.2
"
,
"version"
:
"1.0.
10
"
,
"description"
:
""
,
"main"
:
"./dist/index.umd.js"
,
"scripts"
:
{
...
...
packages/toolkit/src/Request/Request.ts
View file @
cf2895b4
...
...
@@ -9,8 +9,8 @@ defaultRequest.interceptors.request.use((config) => {
return
{
...
config
,
headers
:
{
uid
:
Utils
.
getCookie
(
UID
),
accessToken
:
Utils
.
getCookie
(
ACCESS_TOKEN
)
uid
:
Utils
.
get
QueryString
(
UID
)
||
Utils
.
get
Cookie
(
UID
),
accessToken
:
Utils
.
get
QueryString
(
ACCESS_TOKEN
)
||
Utils
.
get
Cookie
(
ACCESS_TOKEN
)
},
}
})
...
...
packages/toolkit/src/Utils/Utils.ts
View file @
cf2895b4
...
...
@@ -13,4 +13,14 @@ export class Utils {
static
setCookie
(
key
:
'uid'
|
'accessToken'
,
value
:
string
):
void
{
Cookies
.
set
(
key
,
value
)
}
// 获取链接上的参数
static
getQueryString
(
name
:
'uid'
|
'accessToken'
):
string
|
null
{
const
reg
=
new
RegExp
(
'(^|&)'
+
name
+
'=([^&]*)(&|$)'
,
'i'
)
const
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
)
if
(
r
!=
null
)
{
return
decodeURI
(
r
[
2
])
}
return
null
}
}
\ No newline at end of file
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