Skip to content

Commit

Permalink
add landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocio De Santiago authored and Rocio De Santiago committed Aug 2, 2024
1 parent 04e526a commit f43e6e3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
14 changes: 14 additions & 0 deletions services/ui-src/src/utils/api/requestMethods/getRequestHeaders.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Auth } from "aws-amplify";

export const getRequestHeaders = async (): Promise<any> => {
try {
const session = await Auth.currentSession();
const token = await session.getIdToken().getJwtToken();
const headers = {
"x-api-key": token,
};
return headers;
} catch (error) {
console.log(error); //eslint-disable-line no-console
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getSignedTemplateUrl } from "./getTemplateUrl";

const testTemplateName = "TestName";

describe("utils/getTemplateUrl", () => {
test("getSignedTemplateUrl()", () => {
expect(getSignedTemplateUrl(testTemplateName)).toBeTruthy();
});
});
12 changes: 12 additions & 0 deletions services/ui-src/src/utils/api/requestMethods/getTemplateUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { API } from "aws-amplify";
import { getRequestHeaders } from "./getRequestHeaders";

export async function getSignedTemplateUrl(templateName: string) {
const requestHeaders = await getRequestHeaders();
const request = {
headers: { ...requestHeaders },
};

const response = await API.get("hcbs", `/templates/${templateName}`, request);
return response;
}

0 comments on commit f43e6e3

Please sign in to comment.