fix: handle rejection for security token not found when opening projects (#441)
* fix: handle rejection for security token not found when opening projects * fix: use longer auto close time for security token not found message Co-authored-by: alex-krasn <64093224+alex-krasn@users.noreply.github.com> Co-authored-by: kunzheng <58841788+kunzms@users.noreply.github.com>
This commit is contained in:
Родитель
1cb4133dca
Коммит
79264e3fdd
|
@ -156,10 +156,16 @@ export default class HomePage extends React.Component<IHomePageProps, IHomePageS
|
|||
}
|
||||
|
||||
private loadSelectedProject = async (project: IProject, sharedToken?: {}) => {
|
||||
try {
|
||||
const loadedProject = await this.props.actions.loadProject(project, sharedToken);
|
||||
if (loadedProject !== null) {
|
||||
this.props.history.push(`/projects/${project.id}/edit`);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof AppError && error.errorCode === ErrorCode.SecurityTokenNotFound) {
|
||||
toast.error(strings.errors.securityTokenNotFound.message, { autoClose: 5000 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private freshLoadSelectedProject = async (project: IProject) => {
|
||||
|
@ -168,7 +174,8 @@ export default class HomePage extends React.Component<IHomePageProps, IHomePageS
|
|||
.find((securityToken) => securityToken.name === project.securityToken);
|
||||
|
||||
if (!projectToken) {
|
||||
throw new AppError(ErrorCode.SecurityTokenNotFound, "Security Token Not Found");
|
||||
toast.error(strings.errors.securityTokenNotFound.message, { autoClose: 3000 });
|
||||
return;
|
||||
}
|
||||
|
||||
// Load project from storage provider to keep the project in latest state
|
||||
|
|
Загрузка…
Ссылка в новой задаче