mirror of
https://github.com/lenalebt/obsidian-pocketbook-cloud-highlight-importer.git
synced 2026-07-22 07:40:24 +00:00
Added simple error handling during login
This commit is contained in:
parent
d2d24f7918
commit
be1626d961
1 changed files with 14 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { requestUrl } from 'obsidian';
|
||||
import { Notice, requestUrl } from 'obsidian';
|
||||
import PocketbookCloudHighlightsImporterPlugin from './main';
|
||||
|
||||
export interface PocketbookCloudBookCover {
|
||||
|
|
@ -188,6 +188,19 @@ export class PocketbookCloudLoginClient {
|
|||
) {}
|
||||
|
||||
async login() {
|
||||
// Validate required parameters
|
||||
if (!this.username || this.username.trim() === '') {
|
||||
new Notice('❌ Error: Username is required and cannot be empty');
|
||||
}
|
||||
|
||||
if (!this.client_id || this.client_id.trim() === '') {
|
||||
new Notice('❌ Error: Client ID is required and cannot be empty');
|
||||
}
|
||||
|
||||
if (!this.client_secret || this.client_secret.trim() === '') {
|
||||
new Notice('❌ Error: Client secret is required and cannot be empty');
|
||||
}
|
||||
|
||||
const shops: PocketbookCloudShopInfo[] = await fetch(
|
||||
'https://cloud.pocketbook.digital/api/v1.0/auth/login?' +
|
||||
new URLSearchParams({
|
||||
|
|
|
|||
Loading…
Reference in a new issue