From 16d3182374a0430b19eb1bc792a7e277b1d08c17 Mon Sep 17 00:00:00 2001 From: yoution Date: Tue, 30 Nov 2021 09:31:13 +0800 Subject: [PATCH] fix: issue #583 --- src/routes/CancelInterviewPage/index.jsx | 22 +++++++++++++--------- src/services/teams.js | 11 ----------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/routes/CancelInterviewPage/index.jsx b/src/routes/CancelInterviewPage/index.jsx index 15a4b1e..4384162 100644 --- a/src/routes/CancelInterviewPage/index.jsx +++ b/src/routes/CancelInterviewPage/index.jsx @@ -7,12 +7,12 @@ import React, { useEffect, useState } from "react"; import { toastr } from "react-redux-toastr"; import Page from "components/Page"; import moment from "moment"; +import axios from "axios"; import PageHeader from "components/PageHeader"; import Button from "components/Button"; import Input from "components/Input"; import LoadingIndicator from "components/LoadingIndicator"; import { getAuthUserProfile } from "@topcoder/micro-frontends-navbar-app"; -import { getJobCandidateById } from "services/teams"; import { getJobById } from "services/jobs"; import { getInterview, cancelInterview } from "services/interviews"; import { INTERVIEW_STATUS } from "constants"; @@ -62,13 +62,17 @@ const CancelInterviewPage = ({ interviewId }) => { ) { setInterview(data); - return getJobCandidateById( - data.jobCandidateId - ).then(({ data: { jobId } }) => - getJobById(jobId).then(({ data: { title } }) => - setJobTitle(title) - ) - ); + return axios + .get(`https://schedule.nylas.com/${data.nylasPageSlug}`) + .then(({ data: nylasHtml }) => { + // extract json object from html file + const nylasconfig = JSON.parse( + nylasHtml.match( + /window.nylasWindowContext.page = (.*);<\/script>/ + )[1] + ); + setJobTitle(nylasconfig.name); + }); } else { setErrorMessage( `This interview has status ${data.status} and cannot be cancelled.` @@ -91,7 +95,7 @@ const CancelInterviewPage = ({ interviewId }) => {
-

Job Interview for "{jobTitle}"

+

{jobTitle}

diff --git a/src/services/teams.js b/src/services/teams.js index 681954f..984d9b4 100644 --- a/src/services/teams.js +++ b/src/services/teams.js @@ -70,17 +70,6 @@ export const getPositionDetails = (teamId, positionId) => { return axios.get(`${config.API.V5}/taas-teams/${teamId}/jobs/${positionId}`); }; -/** - * Get Job Candidate. - * - * @param {string} candidateId position candidate id - * - * @returns {Promise} position candidate - */ -export const getJobCandidateById = (candidateId) => { - return axios.get(`${config.API.V5}/jobCandidates/${candidateId}`); -}; - /** * Patch Position Candidate *