Sfoglia il codice sorgente

handle no internet connection error

Abhinav-grd 4 anni fa
parent
commit
24a0f75930

+ 3 - 0
src/pages/gallery/components/CollectionDropZone.tsx

@@ -1,6 +1,7 @@
 import React from 'react';
 import UploadService from 'services/uploadService';
 import { getToken } from 'utils/common/key';
+import { ERR_NO_INTERNET_CONNECTION } from './CreateCollection';
 import DropzoneWrapper from './DropzoneWrapper';
 
 function CollectionDropZone({
@@ -32,6 +33,8 @@ function CollectionDropZone({
             if (err.response) {
                 setBannerErrorCode(err.response.status);
             }
+            setBannerErrorCode(ERR_NO_INTERNET_CONNECTION);
+            setProgressView(false);
         }
     };
     return (

+ 4 - 0
src/pages/gallery/components/CreateCollection.tsx

@@ -6,6 +6,8 @@ import { CollectionAndItsLatestFile } from 'services/collectionService';
 import { getToken } from 'utils/common/key';
 import constants from 'utils/strings/constants';
 
+export const ERR_NO_INTERNET_CONNECTION = 0;
+
 export default function CreateCollection(props) {
     const {
         acceptedFiles,
@@ -76,6 +78,8 @@ export default function CreateCollection(props) {
             if (err.response) {
                 setBannerErrorCode(err.response.status);
             }
+            setBannerErrorCode(ERR_NO_INTERNET_CONNECTION);
+            setProgressView(false);
         }
     };
     return (

+ 2 - 0
src/utils/strings/englishConstants.tsx

@@ -82,6 +82,8 @@ const englishConstants = {
     ZOOM_IN_OUT: 'Zoom in/out',
     PREVIOUS: 'Previous (arrow left)',
     NEXT: 'Next (arrow right)',
+    NO_INTERNET_CONNECTION:
+        'You seem to be offline please check your internet connection and try again',
 };
 
 export default englishConstants;