-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wpcom-proxy-request: Return Promise if no callback specified (Take Tw…
…o) (#39722) The promise wrapper introduced et al. in #38823 is generic enough for it to make sense to have it in `wpcom-proxy-request`. This commit moves it there. This follows [precedent](https://github.com/Automattic/wp-calypso/blob/bf345c5b040e75808fb2f92c9b9e34e6f126a235/packages/wpcom.js/src/lib/util/send-request.js#L78-L93) set by `wpcom.js`. Note that this is a technically a breaking change, as noted in the package's `History.md`: Co-authored-by: Jon Surrell <jon.surrell@automattic.com> This reverts commit 7f5092a.
- Loading branch information
Showing
15 changed files
with
91 additions
and
69 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 |
---|---|---|
|
@@ -21,4 +21,3 @@ Dockerfile | |
/apps/*/dist/ | ||
/apps/*/types/ | ||
/packages/*/dist/ | ||
/packages/*/types/ |
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 was deleted.
Oops, something went wrong.
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,4 @@ | ||
export interface WpcomClientCredentials { | ||
client_id: string; | ||
client_secret: string; | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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,25 @@ | ||
/** | ||
* TypeScript type definitions for wpcom-proxy-request | ||
* | ||
* @todo Migrate `src/index.js` to TypeScript, incorporate these type definitions. | ||
* (Needs changes to the build chain, see other packages in the monorepo | ||
* for inspiration, e.g. `@automattic/data-stores`.) | ||
*/ | ||
|
||
export interface WpcomRequestParams { | ||
path?: string; | ||
method?: string; | ||
apiVersion?: string; | ||
body?: object; | ||
token?: string; | ||
metaAPI?: { | ||
accessAllUsersBlogs?: boolean; | ||
}; | ||
} | ||
|
||
export function reloadProxy(): void; | ||
|
||
export function requestAllBlogsAccess(): ReturnType< typeof request >; | ||
|
||
export default function request( params: WpcomRequestParams, callback: Function ): XMLHttpRequest; | ||
export default function request< T >( params: WpcomRequestParams ): Promise< T >; |