From 6cae8a7997cca5c0a33f89536b32d45e8a349113 Mon Sep 17 00:00:00 2001 From: Leland Garofalo Date: Mon, 25 Mar 2024 16:56:15 -0700 Subject: [PATCH] Use v2 API route for GET resources by ID --- app/models/Organization.ts | 2 +- app/pages/OrganizationEditPage.tsx | 2 +- cypress/e2e/organization_page.cy.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/Organization.ts b/app/models/Organization.ts index cfd7a6611..bb9c91c51 100644 --- a/app/models/Organization.ts +++ b/app/models/Organization.ts @@ -51,7 +51,7 @@ export interface OrganizationAction { * into a nicer-to-use data model of RecurringSchedules. */ export const fetchOrganization = (id: string): Promise => - get(`/api/resources/${id}`).then( + get(`/api/v2/resources/${id}`).then( ({ resource }: { resource: Organization }) => { const recurringSchedule = parseAPISchedule(resource.schedule); return { diff --git a/app/pages/OrganizationEditPage.tsx b/app/pages/OrganizationEditPage.tsx index 57c7f6be8..19a87df05 100644 --- a/app/pages/OrganizationEditPage.tsx +++ b/app/pages/OrganizationEditPage.tsx @@ -898,7 +898,7 @@ class OrganizationEditPage extends React.Component { } const resourceID = params.id; if (resourceID) { - const url = `/api/resources/${resourceID}`; + const url = `/api/v2/resources/${resourceID}`; fetch(url) .then((r) => r.json()) .then((data) => diff --git a/cypress/e2e/organization_page.cy.ts b/cypress/e2e/organization_page.cy.ts index cc9eefb11..2dd69631a 100644 --- a/cypress/e2e/organization_page.cy.ts +++ b/cypress/e2e/organization_page.cy.ts @@ -27,7 +27,7 @@ describe("Organization Page", () => { expect(r.status).to.eq(201); }); - cy.request<{ resource: Organization }>(`/api/resources/${orgId}`).then( + cy.request<{ resource: Organization }>(`/api/v2/resources/${orgId}`).then( (res) => { expect(res.status).to.eq(200); expect(res.body.resource).to.include.all.keys( @@ -70,7 +70,7 @@ describe("Organization Page", () => { }); it("should render services section with multiple services", () => { - cy.request<{ resource: Organization }>(`/api/resources/${orgId}`).then( + cy.request<{ resource: Organization }>(`/api/v2/resources/${orgId}`).then( (res) => { expect(res.status).to.eq(200); expect(res.body.resource).to.include.all.keys( @@ -125,7 +125,7 @@ describe("Organization Page", () => { // Intercept client's AJAX request to services endpoint and alias as "getResourceData". Pass // the alias to #wait method below to delay test execution until the request has returned - cy.intercept("GET", `/api/resources/${orgId}`).as("getResourceData"); + cy.intercept("GET", `/api/v2/resources/${orgId}`).as("getResourceData"); cy.request<{ services: Service[] }>( "POST", `/api/resources/${orgId}/services`,