Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
03a1ce6b
Commit
03a1ce6b
authored
Jun 16, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix upload API
parent
da0d79e4
Pipeline
#27788
passed with stages
in 7 minutes and 50 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
20 deletions
+24
-20
src/api/mdproDeck/sync.ts
src/api/mdproDeck/sync.ts
+2
-2
src/api/mdproDeck/updatePulibc.ts
src/api/mdproDeck/updatePulibc.ts
+2
-2
src/api/mdproDeck/upload.ts
src/api/mdproDeck/upload.ts
+20
-16
No files found.
src/api/mdproDeck/sync.ts
View file @
03a1ce6b
...
...
@@ -8,7 +8,6 @@ const API_PATH = "/api/mdpro3/sync/single";
export
interface
SyncReq
{
userId
:
number
;
token
:
string
;
deckContributor
:
string
;
deck
:
{
deckId
:
string
;
...
...
@@ -20,10 +19,11 @@ export interface SyncReq {
export
async
function
syncDeck
(
req
:
SyncReq
,
token
:
string
,
):
Promise
<
MdproResp
<
boolean
>
|
undefined
>
{
const
myHeaders
=
mdproHeaders
();
myHeaders
.
append
(
"
Content-Type
"
,
"
application/json
"
);
myHeaders
.
append
(
"
token
"
,
req
.
token
);
myHeaders
.
append
(
"
token
"
,
token
);
const
resp
=
await
fetch
(
`
${
mdproServer
}
/
${
API_PATH
}
`
,
{
method
:
"
POST
"
,
...
...
src/api/mdproDeck/updatePulibc.ts
View file @
03a1ce6b
...
...
@@ -8,17 +8,17 @@ const API_PATH = "/api/mdpro3/deck/public";
export
interface
UpdatePublicReq
{
userId
:
number
;
token
:
string
;
deckId
:
string
;
isPublic
:
boolean
;
}
export
async
function
updatePublic
(
req
:
UpdatePublicReq
,
token
:
string
,
):
Promise
<
MdproResp
<
void
>
|
undefined
>
{
const
myHeaders
=
mdproHeaders
();
myHeaders
.
append
(
"
Content-Type
"
,
"
application/json
"
);
myHeaders
.
append
(
"
token
"
,
req
.
token
);
myHeaders
.
append
(
"
token
"
,
token
);
const
resp
=
await
fetch
(
`
${
mdproServer
}
/
${
API_PATH
}
`
,
{
method
:
"
POST
"
,
...
...
src/api/mdproDeck/upload.ts
View file @
03a1ce6b
...
...
@@ -25,9 +25,9 @@ export async function uploadDeck(
const
deckId
=
generateResp
.
data
;
const
syncRes
=
await
syncDeck
({
const
syncRes
=
await
syncDeck
(
{
userId
:
req
.
userId
,
token
:
req
.
token
,
deckContributor
:
req
.
deckContributor
,
deck
:
{
deckId
,
...
...
@@ -35,19 +35,23 @@ export async function uploadDeck(
deckCase
:
req
.
deck
.
deckCase
,
deckYdk
:
req
.
deck
.
deckYdk
,
},
});
},
req
.
token
,
);
if
(
syncRes
===
undefined
)
return
undefined
;
if
(
syncRes
.
code
===
0
&&
syncRes
.
data
===
true
)
{
// succeed in syncing
return
await
updatePublic
({
return
await
updatePublic
(
{
userId
:
req
.
userId
,
token
:
req
.
token
,
deckId
,
isPublic
:
true
,
});
},
req
.
token
,
);
}
else
{
return
{
code
:
syncRes
.
code
,
message
:
syncRes
.
message
};
}
...
...
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