Skip to content

Commit

Permalink
Merge pull request #35 from FG-AI4H/feature/search-permission
Browse files Browse the repository at this point in the history
fix: fix missing data_owner_id in Link Dataset
  • Loading branch information
mllabai authored Jul 12, 2024
2 parents ecaa142 + 6c50a14 commit 9bedd70
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/api/common.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { API_ROUTES } from '../common/constants/apiRoutes';

export async function getUserInfo(axiosBase) {
try {
const res = axiosBase.get(API_ROUTES.GET_USER_INFO);
const res = await axiosBase.get(API_ROUTES.GET_USER_INFO);
return res?.data;
} catch (e) {
return null;
Expand Down
18 changes: 10 additions & 8 deletions src/components/DatasetForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,16 @@ const DatasetForm = (props) => {
const client = new DatasetClient(
response.signInUserSession.accessToken.jwtToken
);
// const newDataset = {
// ...dataset,
// metadata: {
// ...dataset.metadata,
// data_owner_id: '1af3331c-853b-44f7-9348-21c41a7f5514',
// },
// };
client.addDataset(dataset).then(
let userInfo = localStorage.getItem('user');
userInfo = JSON.parse(userInfo || null);
const tempDataset = {
...dataset,
metadata: {
...dataset?.metadata,
data_owner_id: userInfo?.id,
},
};
client.addDataset(tempDataset).then(
(response) => {
setIsLoading(false);
props.navigation(
Expand Down
18 changes: 15 additions & 3 deletions src/views/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ export default function Home() {

useEffect(() => {
(async () => {
const user = await getUserInfo(axiosBase);
user && localStorage.setItem('user', user);
let userInfo = localStorage.getItem('user');
userInfo = JSON.parse(userInfo || null);
if (!userInfo) {
const user = await getUserInfo(axiosBase);
console.log(user);
user && localStorage.setItem('user', JSON.stringify(user));
}
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down Expand Up @@ -53,6 +58,7 @@ export default function Home() {
component='img'
height='180'
image='home_datasets.png'
sx={{ objectPosition: 'right' }}
/>
<CardContent>
<Typography gutterBottom variant='h5' component='div'>
Expand Down Expand Up @@ -83,6 +89,7 @@ export default function Home() {
component='img'
height='180'
image='home_annotation.png'
sx={{ objectPosition: 'right' }}
/>
<CardContent>
<Typography gutterBottom variant='h5' component='div'>
Expand All @@ -109,7 +116,12 @@ export default function Home() {

<Grid item xs={12} md={4}>
<Card>
<CardMedia component='img' height='180' image='home_eval.png' />
<CardMedia
component='img'
height='180'
image='home_eval.png'
sx={{ objectPosition: 'right' }}
/>
<CardContent>
<Typography gutterBottom variant='h5' component='div'>
Evaluation Platform
Expand Down

0 comments on commit 9bedd70

Please sign in to comment.