From 24a0f759307acc2fa7a411d5433f46cfe1ddbc5f Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Thu, 18 Feb 2021 13:36:05 +0530 Subject: [PATCH] handle no internet connection error --- src/pages/gallery/components/CollectionDropZone.tsx | 3 +++ src/pages/gallery/components/CreateCollection.tsx | 4 ++++ src/utils/strings/englishConstants.tsx | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/pages/gallery/components/CollectionDropZone.tsx b/src/pages/gallery/components/CollectionDropZone.tsx index 66fc82046..349ac66f3 100644 --- a/src/pages/gallery/components/CollectionDropZone.tsx +++ b/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 ( diff --git a/src/pages/gallery/components/CreateCollection.tsx b/src/pages/gallery/components/CreateCollection.tsx index 7f8a6b0ca..2ddaf2ef0 100644 --- a/src/pages/gallery/components/CreateCollection.tsx +++ b/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 ( diff --git a/src/utils/strings/englishConstants.tsx b/src/utils/strings/englishConstants.tsx index a13f97e60..45801fa2b 100644 --- a/src/utils/strings/englishConstants.tsx +++ b/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;