Skip to content

Commit ee1d301

Browse files
committed
fix(agenda2): 🐛 parse todoist id error
todoist had changed task url format
1 parent 6a43384 commit ee1d301

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/helper/todoist.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ export const transformEventToTodoistEvent = (event: IEvent) => {
223223
const todoistIdLink = event.properties?.todoistId
224224
const reg = event.format === 'markdown' ? MARKDOWN_TODOISTLINK_REG : ORG_TODOISTLINK_REG
225225
const url = todoistIdLink?.match?.(reg)?.[1]
226+
// old url: https://todoist.com/showTask?id=6957662645
226227
if (url) todoistId = new URL(url).searchParams.get('id')
228+
// new url: https://app.todoist.com/app/task/6957662645
229+
if (todoistId === null) todoistId = url.split('/').pop()
227230
return {
228231
...event,
229232
todoistId: String(todoistId),

0 commit comments

Comments
 (0)