You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Desktop: Improved Nextcloud API error handling
This commit is contained in:
@ -50,18 +50,22 @@ class SyncTargetNextcloud extends BaseSyncTarget {
|
||||
return new Synchronizer(this.db(), await this.fileApi(), Setting.value('appType'));
|
||||
}
|
||||
|
||||
async appApi() {
|
||||
if (!this.appApi_) {
|
||||
this.appApi_ = new JoplinServerApi({
|
||||
baseUrl: () => JoplinServerApi.baseUrlFromNextcloudWebDavUrl(Setting.value('sync.5.path')),
|
||||
username: () => Setting.value('sync.5.username'),
|
||||
password: () => Setting.value('sync.5.password'),
|
||||
});
|
||||
async appApi(settings = null) {
|
||||
const useCache = !settings;
|
||||
|
||||
this.appApi_.setLogger(this.logger());
|
||||
}
|
||||
if (this.appApi_ && useCache) return this.appApi_;
|
||||
|
||||
return this.appApi_;
|
||||
const appApi = new JoplinServerApi({
|
||||
baseUrl: () => JoplinServerApi.baseUrlFromNextcloudWebDavUrl(settings ? settings['sync.5.path'] : Setting.value('sync.5.path')),
|
||||
username: () => settings ? settings['sync.5.username'] : Setting.value('sync.5.username'),
|
||||
password: () => settings ? settings['sync.5.password'] : Setting.value('sync.5.password'),
|
||||
});
|
||||
|
||||
appApi.setLogger(this.logger());
|
||||
|
||||
if (useCache) this.appApi_ = appApi;
|
||||
|
||||
return appApi;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user