Skip to content

Commit

Permalink
replace institution id with name
Browse files Browse the repository at this point in the history
  • Loading branch information
hams7504 committed Dec 4, 2023
1 parent bcbbb7f commit 3f9e5ed
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pages/DatasetSearch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useEffect, useState } from 'react';
import { Notifications } from '../libs/utils';
import { DataSet } from '../libs/ajax';
import { DataSet, Institution } from '../libs/ajax';
import DatasetSearchTable from '../components/data_search/DatasetSearchTable';
import broadIcon from '../logo.svg';
import duosIcon from '../images/duos-network-logo.svg';
Expand Down Expand Up @@ -48,6 +48,7 @@ export const DatasetSearch = (props) => {
const [loading, setLoading] = useState(true);
const user = Storage.getCurrentUser();
const institution = user.institution?.id;
const [institutionName, setInstitutionName] = useState();

// branded study table versions
const versions = {
Expand Down Expand Up @@ -107,7 +108,7 @@ export const DatasetSearch = (props) => {
'myinstitution': {
query: user.isSigningOfficial ? signingOfficialQuery(institution) : myInstitutionQuery(institution),
icon: null,
title: institution + ' Data Library',
title: institutionName + ' Data Library',
},
'nhgri': {
query: {
Expand Down Expand Up @@ -180,6 +181,10 @@ export const DatasetSearch = (props) => {
props.history.push('/profile');
return;
}
else {
const res = await Institution.getById(institution);
setInstitutionName(res.name);
}
try {
await DataSet.searchDatasetIndex(query).then((datasets) => {
setDatasets(datasets);
Expand Down

0 comments on commit 3f9e5ed

Please sign in to comment.