Skip to content

Commit

Permalink
update API URL hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi committed Nov 4, 2024
1 parent a76b6ae commit 29fc836
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/content/keyAutoAdd/testWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ type AccountDetails = {
};
};

const API_ORIGIN =
location.host === 'wallet.interledger.cards'
? 'https://api.interledger.cards'
: `https://api.${location.host}`;

const waitForLogin: Run<void> = async (
{ keyAddUrl },
{ skip, setNotificationSize },
Expand Down Expand Up @@ -125,7 +130,7 @@ const findWallet: Run<{ accountId: string; walletId: string }> = async (

const addKey: Run<void> = async ({ publicKey, nickName }, { output }) => {
const { accountId, walletId } = output(findWallet);
const url = `https://api.${location.host}/accounts/${accountId}/wallet-addresses/${walletId}/upload-key`;
const url = `${API_ORIGIN}/accounts/${accountId}/wallet-addresses/${walletId}/upload-key`;
const res = await fetch(url, {
method: 'POST',
headers: {
Expand All @@ -147,7 +152,7 @@ const addKey: Run<void> = async ({ publicKey, nickName }, { output }) => {

// region: Helpers
async function revokeKey(accountId: string, walletId: string, keyId: string) {
const url = `https://api.${location.host}/accounts/${accountId}/wallet-addresses/${walletId}/${keyId}/revoke-key/`;
const url = `${API_ORIGIN}/accounts/${accountId}/wallet-addresses/${walletId}/${keyId}/revoke-key/`;
const res = await fetch(url, {
method: 'PATCH',
headers: {
Expand Down

0 comments on commit 29fc836

Please sign in to comment.