Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
fix: pass apihost to appItem
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Jul 27, 2021
1 parent c7bda66 commit 3eb8478
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"start:test": "env-cmd -f ./.env.test react-scripts start",
"start:ci": "react-scripts -r @cypress/instrument-cra start",
"build": "react-scripts build",
"dist": "env-cmd -f ./.env.production react-scripts build",
"eject": "react-scripts eject",
"lint": "eslint .",
"prettier:check": "prettier --check src/**/*.js",
Expand Down
24 changes: 21 additions & 3 deletions src/components/common/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ import {
buildFolderButtonId,
FOLDER_NAME_TITLE_CLASS,
} from '../../config/selectors';
import { SCREEN_MAX_HEIGHT } from '../../config/constants';
import { API_HOST, SCREEN_MAX_HEIGHT } from '../../config/constants';

const { useItem, useChildren, useFileContent, useS3FileContent } = hooks;
const {
useItem,
useChildren,
useFileContent,
useS3FileContent,
useCurrentMember,
} = hooks;

const useStyles = makeStyles((theme) => ({
container: {
Expand All @@ -36,6 +42,7 @@ const Item = ({ id, isChildren }) => {
const { t } = useTranslation();
const classes = useStyles();
const { data: item, isLoading, isError } = useItem(id);
const { data: user, isLoading: isMemberLoading } = useCurrentMember();

// fetch children if item is folder
const isFolder = Boolean(item?.get('type') === ITEM_TYPES.FOLDER);
Expand Down Expand Up @@ -110,7 +117,18 @@ const Item = ({ id, isChildren }) => {
return <DocumentItem id={buildDocumentId(id)} item={item} readOnly />;
}
case ITEM_TYPES.APP: {
return <AppItem id={buildAppId(id)} item={item} readOnly />;
if (isMemberLoading) {
return <Loader />;
}

return (
<AppItem
id={buildAppId(id)}
item={item}
apiHost={API_HOST} // todo: to change
user={user}
/>
);
}
default:
console.error(`The type ${item?.get('type')} is not defined`);
Expand Down

0 comments on commit 3eb8478

Please sign in to comment.