Skip to content

Commit

Permalink
pr: replace v2 api endpoint w/ v3
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwayson committed Sep 9, 2021
1 parent d35774f commit 9f840a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
4 changes: 3 additions & 1 deletion packages/sites/src/_remove-site-from-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export function _removeSiteFromIndex(
if (hubRequestOptions.isPortal) {
return Promise.resolve();
} else {
const url = `${getHubApiUrl(hubRequestOptions)}/v2/${siteModel.item.id}`;
const url = `${getHubApiUrl(hubRequestOptions)}/api/v3/${
siteModel.item.id
}`;
const opts = {
method: "DELETE",
mode: "cors",
Expand Down
30 changes: 15 additions & 15 deletions packages/sites/test/_remove-site-from-index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ describe("_removeSiteFromIndex", () => {
const ro = {
hubApiUrl: "foobar",
authentication: {
token: "token"
}
token: "token",
},
} as IHubRequestOptions;

const siteModel = {
item: {
id: "baz"
}
id: "baz",
},
} as IModel;

fetchMock.delete(`${ro.hubApiUrl}/v2/${siteModel.item.id}`, {});
fetchMock.delete(`${ro.hubApiUrl}/api/v3/${siteModel.item.id}`, {});

await _removeSiteFromIndex(siteModel, ro);

Expand All @@ -32,17 +32,17 @@ describe("_removeSiteFromIndex", () => {
const ro = {
hubApiUrl: "foobar",
authentication: {
token: "token"
}
token: "token",
},
} as IHubRequestOptions;

const siteModel = {
item: {
id: "baz"
}
id: "baz",
},
} as IModel;

fetchMock.delete(`${ro.hubApiUrl}/v2/${siteModel.item.id}`, 400);
fetchMock.delete(`${ro.hubApiUrl}/api/v3/${siteModel.item.id}`, 400);

try {
await _removeSiteFromIndex(siteModel, ro);
Expand All @@ -59,17 +59,17 @@ describe("_removeSiteFromIndex", () => {
isPortal: true,
hubApiUrl: "foobar",
authentication: {
token: "token"
}
token: "token",
},
} as IHubRequestOptions;

const siteModel = {
item: {
id: "baz"
}
id: "baz",
},
} as IModel;

fetchMock.delete(`${ro.hubApiUrl}/v2/${siteModel.item.id}`, {});
fetchMock.delete(`${ro.hubApiUrl}/api/v3/${siteModel.item.id}`, {});

await _removeSiteFromIndex(siteModel, ro);

Expand Down

0 comments on commit 9f840a7

Please sign in to comment.