Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

fix: issue #583 #584

Merged
merged 1 commit into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/routes/CancelInterviewPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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.`
Expand All @@ -91,7 +95,7 @@ const CancelInterviewPage = ({ interviewId }) => {
<PageHeader title="Cancel Interview" />
<div>
<div styleName="top-bar">
<h1>Job Interview for "{jobTitle}"</h1>
<h1>{jobTitle}</h1>
</div>
<div styleName="shadowed-content">
<div styleName="slot-cancelview">
Expand Down
11 changes: 0 additions & 11 deletions src/services/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<object{}>} position candidate
*/
export const getJobCandidateById = (candidateId) => {
return axios.get(`${config.API.V5}/jobCandidates/${candidateId}`);
};

/**
* Patch Position Candidate
*
Expand Down