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

fix: pass apihost to appItem #20

Merged
merged 1 commit into from
Jul 28, 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
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