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

pepfar-datim/react-lib-network-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: This repo is no longer in use. Please use https://github.com/pepfar-datim/javascript-libraries instead.

DHIS2 Network Check

Repo Owner: Ben Guaraldi @benguaraldi

Minimalistic REACT component to warn user they're offline or their session expired.

you're offline your session expired

It's based on notistack https://www.npmjs.com/package/notistack
Which uses amazing REACT Material UI Snackbar https://material-ui.com/components/snackbars/

Installation

npm i @pepfar-react-lib/network-check
npm i notistack

Usage

import {SnackbarProvider} from 'notistack';
import {NetworkCheck} from '@pepfar-react-lib/network-check';

<SnackbarProvider>
    <NetworkCheck intervalMs={5000} baseUrl='https://play.dhis2.org/'/>
</SnackbarProvider>

Notes

<NetworkCheck/> component can be only used inside <SnackbarProvider> context.

Why? <SnackbarProvider> manages output of info/alert messages. <NetworkCheck/> will share one instance of <SnackbarProvider> in your app with other services. Rather than overlapping over another existing instance.

Development

git clone https://github.com/dhis2-app/network-check.git && cd network-check 
npm install
npm start

Don't forget to run tests

npm test

And build with:

npm build

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •