diff --git a/src/index.ts b/src/index.ts index b289928..856beba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,6 +84,9 @@ const KidShiftTaskCompleteIntentHandler = { }, async handle(handlerInput: Alexa.HandlerInput) { + const attributeUtils = new AttributeUtils(handlerInput); + TaskService.setToken(await attributeUtils.getToken()); + const taskList: TaskListResponse = await TaskService.getTasks() const childList: ChildListResponse = await ChildService.getChildList(); @@ -106,9 +109,6 @@ const KidShiftTaskCompleteIntentHandler = { .getResponse(); } - const attributeUtils = new AttributeUtils(handlerInput); - TaskService.setToken(await attributeUtils.getToken()); - return TaskService.completeTask(task.id, child.id).then(() => { return handlerInput.responseBuilder .speak('Task completed')