mirror of
https://github.com/heroblackink/ultimate-todoist-sync-for-obsidian.git
synced 2026-07-22 07:40:27 +00:00
fix: non-existent method call and empty project dropdown in settings
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
a425ff6083
commit
eb32a6a985
1 changed files with 6 additions and 4 deletions
|
|
@ -135,6 +135,10 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
|
|||
);
|
||||
|
||||
const myProjectsOptions: Record<string, string> = {};
|
||||
const projects = this.plugin.todoistSyncAPI?.getSyncData()?.projects || [];
|
||||
for (const p of projects) {
|
||||
myProjectsOptions[p.id] = p.name;
|
||||
}
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Default Project')
|
||||
|
|
@ -144,7 +148,7 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
|
|||
.addOption(this.plugin.settings.defaultProjectId, this.plugin.settings.defaultProjectName)
|
||||
.addOptions(myProjectsOptions)
|
||||
.onChange(async (value) => {
|
||||
const project = this.plugin.todoistSyncAPI?.getSyncData()?.projects?.find((p: any) => p.id === value);
|
||||
const project = projects.find((p: any) => p.id === value);
|
||||
await this.plugin.safeSettings?.update({
|
||||
defaultProjectId: value,
|
||||
defaultProjectName: project?.name || value
|
||||
|
|
@ -263,12 +267,10 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
|
|||
return
|
||||
}
|
||||
try {
|
||||
await this.plugin.scheduledSynchronization()
|
||||
this.plugin.syncLock = false
|
||||
await this.plugin.scheduler.run()
|
||||
new Notice('Sync completed.')
|
||||
} catch (error) {
|
||||
new Notice(`Sync error: ${error}`)
|
||||
this.plugin.syncLock = false;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue