kidshift-skills/lambda/AttributeUtils.js
2024-07-17 09:19:40 +09:00

27 lines
964 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class AttributeUtils {
constructor(handlerInput) {
this.handlerInput = handlerInput;
}
async saveAttributes() {
await this.handlerInput.attributesManager.savePersistentAttributes();
}
async setToken(token) {
return await this.handlerInput.attributesManager.getPersistentAttributes().then((attributes) => {
attributes.token = token;
return attributes;
}).then((attributes) => {
this.handlerInput.attributesManager.setPersistentAttributes(attributes);
}).finally(() => {
return this.saveAttributes();
});
}
async getToken() {
return await this.handlerInput.attributesManager.getPersistentAttributes().then((attributes) => {
return attributes.token;
});
}
}
exports.default = AttributeUtils;
//# sourceMappingURL=AttributeUtils.js.map