File tree Expand file tree Collapse file tree
src/views/SignPDF/_partials Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
3+ * SPDX-License-Identifier: AGPL-3.0-or-later
4+ */
5+
6+ export const NON_RETRIABLE_SIGN_ERROR_CODE = 422
7+
8+ type SignMethodLike = {
9+ method ?: string
10+ modalCode ?: string
11+ }
12+
13+ type SignErrorLike = {
14+ code ?: number | string
15+ }
16+
17+ type SubmissionErrorLike = {
18+ errors ?: SignErrorLike [ ]
19+ }
20+
21+ export function shouldCloseCurrentModalOnSignError (
22+ methodConfig : SignMethodLike ,
23+ signError : SubmissionErrorLike ,
24+ ) : boolean {
25+ const modalCode = methodConfig . modalCode || methodConfig . method || 'token'
26+ if ( modalCode !== 'password' ) {
27+ return false
28+ }
29+
30+ const errors = Array . isArray ( signError . errors ) ? signError . errors : [ ]
31+ return errors . some ( ( error ) => Number ( error ?. code ) === NON_RETRIABLE_SIGN_ERROR_CODE )
32+ }
You can’t perform that action at this time.
0 commit comments