mirror of
https://github.com/r-ca/kidshift-skills.git
synced 2024-10-25 17:14:03 +00:00
built
This commit is contained in:
parent
04cba883f5
commit
3f07a3d423
|
@ -1,24 +1,13 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Method = exports.Endpoints = exports.Configs = void 0;
|
||||
const Configs = Object.freeze({
|
||||
API_BASE: 'https://kidshift-beta.nem.one',
|
||||
exports.MESSAGES = void 0;
|
||||
const MESSAGES = Object.freeze({
|
||||
TASK_COMPLETED: 'タスクの完了を記録しました',
|
||||
TASK_NOT_FOUND: 'タスクが見つかりません',
|
||||
CHILD_NOT_FOUND: '子供が見つかりません',
|
||||
ERROR_OCCURRED: 'エラーが発生しました',
|
||||
NOT_LOGGED_IN: 'ログインしていません',
|
||||
LOGGED_IN: 'ログインしました',
|
||||
});
|
||||
exports.Configs = Configs;
|
||||
var Method;
|
||||
(function (Method) {
|
||||
Method["GET"] = "GET";
|
||||
Method["POST"] = "POST";
|
||||
Method["PUT"] = "PUT";
|
||||
Method["DELETE"] = "DELETE";
|
||||
})(Method || (exports.Method = Method = {}));
|
||||
const Endpoints = Object.freeze({
|
||||
LOGIN: {
|
||||
method: Method.POST,
|
||||
endpoint: '/parent/auth/login',
|
||||
response: {},
|
||||
request: {},
|
||||
},
|
||||
});
|
||||
exports.Endpoints = Endpoints;
|
||||
exports.MESSAGES = MESSAGES;
|
||||
//# sourceMappingURL=const.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":";;;AAEA,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1B,QAAQ,EAAE,+BAA+B;CAC5C,CAAC,CAAC;AA6BC,0BAAO;AA3BX,IAAK,MAKJ;AALD,WAAK,MAAM;IACP,qBAAW,CAAA;IACX,uBAAa,CAAA;IACb,qBAAW,CAAA;IACX,2BAAiB,CAAA;AACrB,CAAC,EALI,MAAM,sBAAN,MAAM,QAKV;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IAE5B,KAAK,EAAE;QACH,MAAM,EAAE,MAAM,CAAC,IAAI;QACnB,QAAQ,EAAE,oBAAoB;QAC9B,QAAQ,EAAE,EAAmB;QAC7B,OAAO,EAAE,EAAsB;KAClC;CACJ,CAAC,CAAC;AAaC,8BAAS"}
|
||||
{"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3B,cAAc,EAAE,eAAe;IAC/B,cAAc,EAAE,aAAa;IAC7B,eAAe,EAAE,YAAY;IAC7B,cAAc,EAAE,YAAY;IAC5B,aAAa,EAAE,YAAY;IAC3B,SAAS,EAAE,UAAU;CACxB,CAAC,CAAC;AAGM,4BAAQ"}
|
|
@ -34,6 +34,7 @@ const AuthService_1 = __importDefault(require("./service/AuthService"));
|
|||
const TaskService_1 = __importDefault(require("./service/TaskService"));
|
||||
const AttributeUtils_1 = __importDefault(require("./AttributeUtils"));
|
||||
const ChildService_1 = __importDefault(require("./service/ChildService"));
|
||||
const const_1 = require("./const");
|
||||
const LaunchRequestHandler = {
|
||||
canHandle(handlerInput) {
|
||||
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest';
|
||||
|
@ -71,7 +72,7 @@ const KidShiftAuthIntentHandler = {
|
|||
await attributeUtils.setToken(tokenResponse.accessToken);
|
||||
await attributeUtils.saveAttributes();
|
||||
return handlerInput.responseBuilder
|
||||
.speak('Login successful')
|
||||
.speak(const_1.MESSAGES.LOGGED_IN)
|
||||
.getResponse();
|
||||
}
|
||||
else {
|
||||
|
@ -110,22 +111,22 @@ const KidShiftTaskCompleteIntentHandler = {
|
|||
const task = taskList.list.find((task) => task.name === taskName);
|
||||
if (!task) {
|
||||
return handlerInput.responseBuilder
|
||||
.speak('Task not found')
|
||||
.speak(const_1.MESSAGES.TASK_NOT_FOUND)
|
||||
.getResponse();
|
||||
}
|
||||
const child = childList.list.find((child) => child.name === childName);
|
||||
if (!child) {
|
||||
return handlerInput.responseBuilder
|
||||
.speak('Child not found')
|
||||
.speak(const_1.MESSAGES.CHILD_NOT_FOUND)
|
||||
.getResponse();
|
||||
}
|
||||
return TaskService_1.default.completeTask(task.id, child.id).then(() => {
|
||||
return handlerInput.responseBuilder
|
||||
.speak('Task completed')
|
||||
.speak(const_1.MESSAGES.TASK_COMPLETED)
|
||||
.getResponse();
|
||||
}).catch(() => {
|
||||
return handlerInput.responseBuilder
|
||||
.speak('Task completion failed')
|
||||
.speak(const_1.MESSAGES.ERROR_OCCURRED)
|
||||
.getResponse();
|
||||
});
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user