Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
* @contentstack/ghost-pr-reviewers

* @contentstack/marketplace-pr-reviewers
.github/workflows/sca-scan.yml @contentstack/security-admin

**/.snyk @contentstack/security-admin
Expand Down
14 changes: 4 additions & 10 deletions src/utils/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ import { axiosToFetchResponse, fetchToAxiosConfig } from "./utils";
export const dispatchAdapter =
(postRobot: typeof PostRobot) =>
(
config: AxiosRequestConfig,
context?: { installationUID: string; extensionUID: string }
config: AxiosRequestConfig
) => {
return new Promise((resolve, reject) => {
postRobot
.sendToParent("apiAdapter", {
data: config,
extension: context,
})
.sendToParent("apiAdapter", config)
.then((event: unknown) => {
const { data: response } = event as { data: AxiosResponse };

Expand Down Expand Up @@ -63,14 +59,12 @@ export const dispatchAdapter =
*/
export const dispatchApiRequest = async (
url: string,
options?: RequestInit,
context?: { installationUID: string; extensionUID: string }
options?: RequestInit
): Promise<Response> => {
try {
const config = fetchToAxiosConfig(url, options);
const axiosResponse = (await dispatchAdapter(PostRobot)(
config,
context
config
)) as AxiosResponse;

return axiosToFetchResponse(axiosResponse);
Expand Down
Loading