Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
vicotor
frontend
Commits
d6294509
Commit
d6294509
authored
Jul 20, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete method
parent
e6906e3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
fetch.ts
api/utils/fetch.ts
+1
-1
[id].ts
pages/api/account/private-tags/address/[id].ts
+21
-0
No files found.
api/utils/fetch.ts
View file @
d6294509
...
@@ -2,7 +2,7 @@ import type { RequestInit, Response } from 'node-fetch';
...
@@ -2,7 +2,7 @@ import type { RequestInit, Response } from 'node-fetch';
import
nodeFetch
from
'
node-fetch
'
;
import
nodeFetch
from
'
node-fetch
'
;
// first arg can be only a string
// first arg can be only a string
// FIXME migrate to RequestInfo later
// FIXME migrate to RequestInfo later
if needed
export
default
function
fetch
(
path
:
string
,
init
?:
RequestInit
):
Promise
<
Response
>
{
export
default
function
fetch
(
path
:
string
,
init
?:
RequestInit
):
Promise
<
Response
>
{
const
headers
=
{
const
headers
=
{
accept
:
'
application/json
'
,
accept
:
'
application/json
'
,
...
...
pages/api/account/private-tags/address/[id].ts
0 → 100644
View file @
d6294509
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'
next
'
import
fetch
from
'
api/utils/fetch
'
;
export
default
async
function
handler
(
_req
:
NextApiRequest
,
res
:
NextApiResponse
)
{
const
{
id
}
=
_req
.
query
;
const
url
=
`/account/v1/user/tags/address/
${
id
}
`
;
switch
(
_req
.
method
)
{
case
'
DELETE
'
:
{
await
fetch
(
url
,
{
method
:
'
DELETE
'
})
res
.
status
(
200
);
break
;
}
default
:
{
res
.
setHeader
(
'
Allow
'
,
[
'
DELETE
'
])
res
.
status
(
405
).
end
(
`Method
${
_req
.
method
}
Not Allowed`
)
}
}
}
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