-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
suggestion: Handle session expiration gracefully (#526)
* Return 403 for api endpoints instead of redirecting. * Stop interval and show modal when API fetches fail. * Created new ErrorModal component. * Only show modal on 403. * Tests. * Fix lint issues. * Fix client tests. * Check current and previous path.
- Loading branch information
Showing
11 changed files
with
157 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.modal.error-modal { | ||
color: $text-primary; | ||
.modal-dialog { | ||
margin-top: 362px; | ||
} | ||
|
||
.modal-content { | ||
background-color: $cool-gray-20; | ||
|
||
.modal-header { | ||
border-bottom: none; | ||
|
||
.btn-close:hover { | ||
background-color: transparent; | ||
} | ||
} | ||
|
||
.modal-footer { | ||
background-color: $cool-gray-20; | ||
border-top: none; | ||
height: 62px; | ||
padding: 0 12px 0 0; | ||
|
||
.btn { | ||
height: 38px; | ||
} | ||
|
||
.error-modal__refresh-button { | ||
background-color: $button-primary; | ||
color: $button-secondary; | ||
} | ||
|
||
.error-modal__cancel-button { | ||
background-color: $cool-gray-20; | ||
color: #c1e4ff; | ||
border: transparent; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from "react"; | ||
import { Button, Modal } from "react-bootstrap"; | ||
|
||
interface ErrorModalProps { | ||
title: string; | ||
showErrorModal: boolean; | ||
onHide: () => void; | ||
errorMessage: string; | ||
confirmButtonLabel: string; | ||
onConfirm: () => void; | ||
} | ||
|
||
const ErrorModal = ({ | ||
title, | ||
showErrorModal, | ||
onHide, | ||
errorMessage, | ||
confirmButtonLabel, | ||
onConfirm, | ||
}: ErrorModalProps) => { | ||
return ( | ||
<Modal | ||
show={showErrorModal} | ||
className="error-modal" | ||
backdrop="static" | ||
onHide={onHide} | ||
> | ||
<Modal.Header closeButton closeVariant="white"> | ||
{title && <Modal.Title>{title}</Modal.Title>} | ||
</Modal.Header> | ||
<Modal.Body>{errorMessage}</Modal.Body> | ||
<Modal.Footer> | ||
<Button onClick={onHide} className="error-modal__cancel-button"> | ||
Cancel | ||
</Button> | ||
<Button className="error-modal__refresh-button" onClick={onConfirm}> | ||
{confirmButtonLabel} | ||
</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ErrorModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters