generated from deco-sites/storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from deco-sites/feature/delete-document
Feature/delete document
- Loading branch information
Showing
10 changed files
with
515 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
export interface Props { | ||
email: string; | ||
subject: string; | ||
content: string; | ||
} | ||
|
||
const signUpCognito = async ( | ||
props: Props, | ||
_req: Request, | ||
): Promise<unknown | null> => { | ||
const params = { | ||
fields: [ | ||
{ | ||
name: "email", | ||
value: props.email, | ||
}, | ||
{ | ||
name: "TICKET.subject", | ||
value: props.subject, | ||
}, | ||
{ | ||
name: "TICKET.content", | ||
value: props.content, | ||
}, | ||
], | ||
}; | ||
try { | ||
const response = await fetch( | ||
`https://api.hsforms.com/submissions/v3/integration/submit/43817859/88ccb64a-bb13-4c72-ade6-1bb9e6157946`, | ||
{ | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify(params), | ||
}, | ||
); | ||
|
||
const res = await response.json(); | ||
return res; | ||
} catch (e) { | ||
// console.log({ e }); | ||
return e; | ||
} | ||
}; | ||
|
||
export default signUpCognito; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export interface Props { | ||
docId: string; | ||
token: string; | ||
} | ||
|
||
const signUpCognito = async ( | ||
props: Props, | ||
_req: Request, | ||
): Promise<unknown | null> => { | ||
console.log({ docId: props.docId }); | ||
try { | ||
const response = await fetch( | ||
`http://localhost:3000/documents/${props.docId}`, | ||
{ | ||
method: "DELETE", | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: props.token, | ||
}, | ||
}, | ||
); | ||
|
||
const res = await response.json(); | ||
return res; | ||
} catch (e) { | ||
// console.log({ e }); | ||
return e; | ||
} | ||
}; | ||
|
||
export default signUpCognito; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.