Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: auto redirect to safe mode on login app error [LIBS-670] #874

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions adapter/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-06-21T08:27:55.991Z\n"
"PO-Revision-Date: 2024-06-21T08:27:55.991Z\n"
"POT-Creation-Date: 2024-08-28T09:08:40.219Z\n"
"PO-Revision-Date: 2024-08-28T09:08:40.219Z\n"

msgid "Save your data"
msgstr "Save your data"
Expand Down Expand Up @@ -51,9 +51,6 @@ msgstr "Try again"
msgid "Something went wrong"
msgstr "Something went wrong"

msgid "Redirect to safe login mode"
msgstr "Redirect to safe login mode"

msgid "Hide technical details"
msgstr "Hide technical details"

Expand Down
16 changes: 7 additions & 9 deletions adapter/src/components/ErrorBoundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export class ErrorBoundary extends Component {
this.props.onPluginError(error)
}
}
if (this.props.loginApp) {
console.error(error)
}
this.setState({
error,
errorInfo,
Expand Down Expand Up @@ -96,6 +99,10 @@ export class ErrorBoundary extends Component {
const { children, fullscreen, onRetry, loginApp, baseURL } = this.props

if (this.state.error) {
if (loginApp && baseURL) {
this.handleSafeLoginRedirect()
}

if (this.props.plugin) {
return (
<>
Expand Down Expand Up @@ -136,15 +143,6 @@ export class ErrorBoundary extends Component {
<h1 className="message">
{i18n.t('Something went wrong')}
</h1>
{loginApp && baseURL && (
<div className="retry">
<UIButton
onClick={this.handleSafeLoginRedirect}
>
{i18n.t('Redirect to safe login mode')}
</UIButton>
</div>
)}
{onRetry && (
<div className="retry">
<UIButton onClick={onRetry}>
Expand Down
Loading