Browse Source

added new state errorCode and added errorAlert component to gallery

Abhinav-grd 4 years ago
parent
commit
ee663bc72c
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/pages/gallery/index.tsx

+ 5 - 2
src/pages/gallery/index.tsx

@@ -21,6 +21,7 @@ import SadFace from 'components/SadFace';
 import Upload from './components/Upload';
 import Upload from './components/Upload';
 import { collection, fetchCollections, collectionLatestFile, getCollectionLatestFile, getFavItemIds } from 'services/collectionService';
 import { collection, fetchCollections, collectionLatestFile, getCollectionLatestFile, getFavItemIds } from 'services/collectionService';
 import constants from 'utils/strings/constants';
 import constants from 'utils/strings/constants';
+import { ErrorAlert } from './components/ErrorAlert';
 
 
 enum ITEM_TYPE {
 enum ITEM_TYPE {
     TIME = 'TIME',
     TIME = 'TIME',
@@ -105,7 +106,7 @@ export default function Gallery(props) {
         maxSpreadZoom: 5,
         maxSpreadZoom: 5,
     });
     });
     const fetching: { [k: number]: boolean } = {};
     const fetching: { [k: number]: boolean } = {};
-
+    const [errorCode, setErrorCode] = useState<number>(null);
 
 
 
 
     useEffect(() => {
     useEffect(() => {
@@ -285,6 +286,7 @@ export default function Gallery(props) {
 
 
     return (
     return (
         <>
         <>
+            <ErrorAlert errorCode={errorCode} />
             <Collections
             <Collections
                 collections={collections}
                 collections={collections}
                 selected={router.query.collection?.toString()}
                 selected={router.query.collection?.toString()}
@@ -296,7 +298,8 @@ export default function Gallery(props) {
                 showUploadModal={props.showUploadModal}
                 showUploadModal={props.showUploadModal}
                 collectionLatestFile={collectionLatestFile}
                 collectionLatestFile={collectionLatestFile}
                 refetchData={() => setReload(Math.random())}
                 refetchData={() => setReload(Math.random())}
-                
+                setErrorCode={setErrorCode}
+
             />
             />
             {filteredData.length ? (
             {filteredData.length ? (
                 <Container>
                 <Container>