(s: SendView)
| 168 | } |
| 169 | |
| 170 | async removeAuth(s: SendView): Promise<boolean> { |
| 171 | if (this.actionPromise != null || s.authType === AuthType.None) { |
| 172 | return; |
| 173 | } |
| 174 | |
| 175 | const i18nKeys = removeSendAuthI18nKeys(s.authType); |
| 176 | const confirmed = await this.dialogService.openSimpleDialog({ |
| 177 | title: { key: i18nKeys.label }, |
| 178 | content: { key: i18nKeys.confirmation }, |
| 179 | type: "warning", |
| 180 | }); |
| 181 | |
| 182 | if (!confirmed) { |
| 183 | return false; |
| 184 | } |
| 185 | |
| 186 | try { |
| 187 | this.actionPromise = this.sendApiService.removeAuth(s.id); |
| 188 | await this.actionPromise; |
| 189 | if (this.onSuccessfulRemoveAuth != null) { |
| 190 | // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. |
| 191 | // eslint-disable-next-line @typescript-eslint/no-floating-promises |
| 192 | this.onSuccessfulRemoveAuth(); |
| 193 | } else { |
| 194 | // Default actions |
| 195 | this.toastService.showToast({ |
| 196 | variant: "success", |
| 197 | title: null, |
| 198 | message: this.i18nService.t(i18nKeys.removed), |
| 199 | }); |
| 200 | await this.load(); |
| 201 | } |
| 202 | } catch (e) { |
| 203 | this.logService.error(e); |
| 204 | } |
| 205 | this.actionPromise = null; |
| 206 | } |
| 207 | |
| 208 | async delete(s: SendView): Promise<boolean> { |
| 209 | if (this.actionPromise != null) { |
no test coverage detected