Skip to content

Commit

Permalink
Fixed the patient list table
Browse files Browse the repository at this point in the history
  • Loading branch information
guaj committed Apr 6, 2022
1 parent eac77cc commit b5fe304
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export default function SymptomsRequiredUpdate() {
handleFormInformationLoad();
}, [patients])


function redirectProfile() {
const user = window.location.href.split("/")[4];
window.location = "/profile/" + user
}


const handleFormInformationLoad = () => {
const patient = patients[0];

Expand Down Expand Up @@ -131,7 +138,7 @@ export default function SymptomsRequiredUpdate() {
const newPatients = [patients];
newPatients[0] = editedPatient;
setPatients(newPatients);
updateRequiredSymptoms(newPatients[0], patientEmail).then();
updateRequiredSymptoms(newPatients[0], patientEmail).then(() => redirectProfile());

};

Expand Down Expand Up @@ -240,6 +247,7 @@ export default function SymptomsRequiredUpdate() {
type="button"
fullWidth={true}
variant="contained"
onClick={redirectProfile}
>
Cancel
</Button>
Expand Down
9 changes: 3 additions & 6 deletions src/components/Dashboard/CommonTabs/patientListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,10 @@ export default function PatientListTable() {
const emptyRows =
page > 0 ? Math.max(0, (1 + page) * rowsPerPage - data.length) : 0;

const profileLink = (email, e) => {
const profileLink = (email) => {
let url = email.split("@")
e.target.reset();
navigate({
pathname: "/profile/" + url[0],
state: email,
})};
return ("/profile/" + url[0]);
};


return (
Expand Down
11 changes: 5 additions & 6 deletions src/components/UserProfile/PatientProfile/PatientProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ class PatientProfilePage extends React.Component {
}

redirectSymptomsRequired() {
const userEmail = JSON.parse(localStorage.getItem("email"));
const urlToFetch = userEmail.split("@")[0]
alert(urlToFetch)
window.location = "/update-required-symptoms/" + urlToFetch
const user = window.location.href.split("/")[4];

window.location = "/update-required-symptoms/" + user
}

scheduleRedirect() {
Expand Down Expand Up @@ -238,11 +237,11 @@ class PatientProfilePage extends React.Component {
</Box>

<Box className="button" sx={{pt: 5}}>
{/*{JSON.parse(localStorage.getItem("type")) !== "patient" ?*/}
{JSON.parse(localStorage.getItem("type")) !== "patient" ?
<Button
variant="contained"
name="update-required-symptoms"
onClick={this.redirectSymptomsRequired}>Update required Symptoms</Button> {/* : <></> *}*/}
onClick={this.redirectSymptomsRequired}>Update required Symptoms</Button> : <></> }
</Box>


Expand Down

0 comments on commit b5fe304

Please sign in to comment.