Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
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
0
Merge Requests
0
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
zhaochengxiang
szse
Commits
a70507b4
Commit
a70507b4
authored
Jun 07, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
69caf6f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
axios.js
src/util/axios.js
+19
-9
No files found.
src/util/axios.js
View file @
a70507b4
...
@@ -8,6 +8,7 @@ import { appId } from '../App';
...
@@ -8,6 +8,7 @@ import { appId } from '../App';
const
CancelToken
=
axios
.
CancelToken
;
const
CancelToken
=
axios
.
CancelToken
;
const
baseURL
=
'/api/'
;
const
baseURL
=
'/api/'
;
const
debugEnv
=
475629450
;
const
instance
=
axios
.
create
({
const
instance
=
axios
.
create
({
baseURL
,
baseURL
,
...
@@ -122,9 +123,10 @@ export function getTemplateType() {
...
@@ -122,9 +123,10 @@ export function getTemplateType() {
export
function
Get
(
url
,
params
)
{
export
function
Get
(
url
,
params
)
{
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
templateType
=
getTemplateType
();
const
templateType
=
getTemplateType
();
const
env
=
LocalStorage
.
get
(
'assetsEnv'
)??
debugEnv
;
return
textplain
.
get
(
url
,
{
return
textplain
.
get
(
url
,
{
params
:
{
templateType
,
...
params
},
cancelToken
params
:
{
templateType
,
env
,
...
params
},
cancelToken
}).
then
(
}).
then
(
callback
callback
)
)
...
@@ -133,9 +135,10 @@ export function Get(url, params) {
...
@@ -133,9 +135,10 @@ export function Get(url, params) {
export
function
GetJSON
(
url
,
params
)
{
export
function
GetJSON
(
url
,
params
)
{
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
templateType
=
getTemplateType
();
const
templateType
=
getTemplateType
();
const
env
=
LocalStorage
.
get
(
'assetsEnv'
)??
debugEnv
;
return
instance
.
get
(
url
,
{
return
instance
.
get
(
url
,
{
params
:
{
templateType
,
...
params
},
cancelToken
,
params
:
{
templateType
,
env
,
...
params
},
cancelToken
,
validateStatus
:
false
validateStatus
:
false
}).
then
(
}).
then
(
callback
callback
...
@@ -145,9 +148,10 @@ export function GetJSON(url, params) {
...
@@ -145,9 +148,10 @@ export function GetJSON(url, params) {
export
const
GetJSONRaw
=
(
url
,
params
)
=>
{
export
const
GetJSONRaw
=
(
url
,
params
)
=>
{
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
templateType
=
getTemplateType
();
const
templateType
=
getTemplateType
();
const
env
=
LocalStorage
.
get
(
'assetsEnv'
)??
debugEnv
;
return
instanceRow
.
get
(
url
,
{
return
instanceRow
.
get
(
url
,
{
params
:
{
templateType
,
...
params
},
cancelToken
,
params
:
{
templateType
,
env
,
...
params
},
cancelToken
,
validateStatus
:
false
validateStatus
:
false
}).
then
(
}).
then
(
callback
callback
...
@@ -157,9 +161,10 @@ export const GetJSONRaw = (url, params) => {
...
@@ -157,9 +161,10 @@ export const GetJSONRaw = (url, params) => {
export
function
Delete
(
url
,
params
)
{
export
function
Delete
(
url
,
params
)
{
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
templateType
=
getTemplateType
();
const
templateType
=
getTemplateType
();
const
env
=
LocalStorage
.
get
(
'assetsEnv'
)??
debugEnv
;
return
instance
.
delete
(
url
,
{
return
instance
.
delete
(
url
,
{
params
:
{
templateType
,
...
params
},
cancelToken
,
params
:
{
templateType
,
env
,
...
params
},
cancelToken
,
}).
then
(
}).
then
(
callback
callback
)
)
...
@@ -169,13 +174,14 @@ export function PostJSON(url, payload) {
...
@@ -169,13 +174,14 @@ export function PostJSON(url, payload) {
const
{
params
=
null
,
data
=
null
}
=
payload
||
{};
const
{
params
=
null
,
data
=
null
}
=
payload
||
{};
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
templateType
=
getTemplateType
();
const
templateType
=
getTemplateType
();
const
env
=
LocalStorage
.
get
(
'assetsEnv'
)??
debugEnv
;
return
IsArr
(
data
)
?
instance
.
post
(
url
,
data
,
{
return
IsArr
(
data
)
?
instance
.
post
(
url
,
data
,
{
params
:
{
templateType
,
...
params
},
cancelToken
params
:
{
templateType
,
env
,
...
params
},
cancelToken
}).
then
(
}).
then
(
callback
callback
)
:
instance
.
post
(
url
,
null
,
{
)
:
instance
.
post
(
url
,
null
,
{
params
:
{
templateType
,
...
params
},
data
,
cancelToken
params
:
{
templateType
,
env
,
...
params
},
data
,
cancelToken
}).
then
(
}).
then
(
callback
callback
)
)
...
@@ -185,9 +191,10 @@ export function Post(url, payload) {
...
@@ -185,9 +191,10 @@ export function Post(url, payload) {
const
{
params
=
null
,
data
=
null
}
=
payload
||
{};
const
{
params
=
null
,
data
=
null
}
=
payload
||
{};
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
cancelToken
=
__source
?
__source
.
token
:
null
;
const
templateType
=
getTemplateType
();
const
templateType
=
getTemplateType
();
const
env
=
LocalStorage
.
get
(
'assetsEnv'
)??
debugEnv
;
return
textplain
.
post
(
url
,
null
,
{
return
textplain
.
post
(
url
,
null
,
{
params
:
{
templateType
,
...
params
},
data
,
cancelToken
params
:
{
templateType
,
env
,
...
params
},
data
,
cancelToken
}).
then
(
}).
then
(
callback
callback
)
)
...
@@ -196,13 +203,14 @@ export function Post(url, payload) {
...
@@ -196,13 +203,14 @@ export function Post(url, payload) {
export
function
PostFile
(
url
,
payload
)
{
export
function
PostFile
(
url
,
payload
)
{
const
{
fileList
=
null
,
params
=
null
}
=
payload
||
{};
const
{
fileList
=
null
,
params
=
null
}
=
payload
||
{};
const
templateType
=
getTemplateType
();
const
templateType
=
getTemplateType
();
const
env
=
LocalStorage
.
get
(
'assetsEnv'
)??
debugEnv
;
let
formData
=
new
FormData
();
let
formData
=
new
FormData
();
(
fileList
||
[]).
forEach
(
file
=>
{
(
fileList
||
[]).
forEach
(
file
=>
{
formData
.
append
(
'file'
,
file
);
formData
.
append
(
'file'
,
file
);
});
});
return
fileplain
.
post
(
url
,
formData
,
{
params
:
{
templateType
,
...
params
}
}
).
then
(
return
fileplain
.
post
(
url
,
formData
,
{
params
:
{
templateType
,
env
,
...
params
}
}
).
then
(
callback
callback
)
)
}
}
...
@@ -217,13 +225,15 @@ export const callFetchRaw = (method, url, options) => {
...
@@ -217,13 +225,15 @@ export const callFetchRaw = (method, url, options) => {
}
}
const
templateType
=
getTemplateType
();
const
templateType
=
getTemplateType
();
const
env
=
LocalStorage
.
get
(
'assetsEnv'
)??
debugEnv
;
var
bodyFormData
=
new
FormData
();
var
bodyFormData
=
new
FormData
();
Object
.
keys
(
params
||
[]).
forEach
(
key
=>
{
Object
.
keys
(
params
||
[]).
forEach
(
key
=>
{
bodyFormData
.
append
(
key
,
params
[
key
]);
bodyFormData
.
append
(
key
,
params
[
key
]);
});
});
bodyFormData
.
append
(
templateType
,
templateType
);
bodyFormData
.
append
(
'templateType'
,
templateType
);
bodyFormData
.
append
(
'env'
,
env
);
return
axios
.
request
({
return
axios
.
request
({
...
...
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