Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit f73195d

Browse files
committed
Fix ping in unauthenticated
1 parent b8bc03a commit f73195d

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

containers/api/ApiProvider.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useRef } from 'react';
22
import PropTypes from 'prop-types';
33
import xhr from 'proton-shared/lib/fetch/fetch';
44
import { getUser } from 'proton-shared/lib/api/user';
5+
import { ping } from 'proton-shared/lib/api/tests';
56
import configureApi from 'proton-shared/lib/api';
67
import withApiHandlers, {
78
CancelUnlockError,
@@ -69,18 +70,16 @@ const ApiProvider = ({ config, onLogout, children, UID }) => {
6970
}
7071

7172
if (e.name === 'OfflineError') {
72-
/*
73-
const text = navigator.onLine
74-
? c('Error').t`Could not connect to server.`
75-
: c('Error').t`No internet connection found`;
76-
*/
7773
const id = createNotification({
7874
type: 'warning',
7975
text: (
8076
<OfflineNotification
8177
onRetry={() => {
82-
// TODO: What route when not logged in?
83-
apiRef.current(getUser());
78+
hideNotification(id);
79+
offlineRef.current = undefined;
80+
// If there is a session, get user to validate it's still active after coming back online
81+
// otherwise if signed out, call ping
82+
apiRef.current(UID ? getUser() : ping());
8483
}}
8584
/>
8685
),

0 commit comments

Comments
 (0)