-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Axios Wrapper and Pass SDK Version Header (#872)
* fix: Axios Wrapper and Pass SDK Version Header * fix: deprecation notice * Update pre-commit
- Loading branch information
1 parent
d579d07
commit a2dee2b
Showing
44 changed files
with
256 additions
and
278 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
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 |
---|---|---|
@@ -1,35 +1,27 @@ | ||
import axios from 'axios'; | ||
import { | ||
getCAIPAddress, | ||
getAPIBaseUrls | ||
} from '../helpers'; | ||
import Constants, {ENV} from '../constants'; | ||
import { getCAIPAddress, getAPIBaseUrls } from '../helpers'; | ||
import Constants, { ENV } from '../constants'; | ||
import { axiosGet } from '../utils/axiosUtil'; | ||
|
||
/** | ||
* GET /v1/channels/{addressinCAIP} | ||
* GET /v1/channels/{addressinCAIP} | ||
*/ | ||
|
||
export type GetChannelOptionsType = { | ||
channel: string; | ||
env?: ENV; | ||
} | ||
}; | ||
|
||
export const getChannel = async ( | ||
options: GetChannelOptionsType | ||
) => { | ||
const { | ||
channel, | ||
env = Constants.ENV.PROD, | ||
} = options || {}; | ||
export const getChannel = async (options: GetChannelOptionsType) => { | ||
const { channel, env = Constants.ENV.PROD } = options || {}; | ||
|
||
const _channel = await getCAIPAddress(env, channel, 'Channel'); | ||
const API_BASE_URL = getAPIBaseUrls(env); | ||
const apiEndpoint = `${API_BASE_URL}/v1/channels`; | ||
const requestUrl = `${apiEndpoint}/${_channel}`; | ||
|
||
return await axios.get(requestUrl) | ||
return await axiosGet(requestUrl) | ||
.then((response) => response.data) | ||
.catch((err) => { | ||
console.error(`[Push SDK] - API ${requestUrl}: `, err); | ||
}); | ||
} | ||
}; |
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
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
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.