first commit

This commit is contained in:
s.golasch
2023-08-01 12:47:58 +02:00
commit b1439a55bb
65 changed files with 3085 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
'use strict'
module.exports = {
RECEIVE_WAKEWORDS: 'RECEIVE_WAKEWORDS',
}

View File

@@ -0,0 +1,12 @@
'use strict'
const {RECEIVE_WAKEWORDS} = require('./action_constants')
module.exports = {
receivedWakewords: wakewords => {
return {
type: RECEIVE_WAKEWORDS,
wakewords,
}
}
}

View File

@@ -0,0 +1,20 @@
'use strict'
const {receivedWakewords} = require('./actions')
module.exports = {
// urls that should be called for the remote actions
urls: {
fetch: 'https://layla.amazon.de/api/wake-word',
},
// called after an remote http call to the user data API has been successfully executed
postHooks: {
// called after the user data has been fetched
fetch: (store, data) => {
return new Promise((resolve, reject) => {
store.dispatch(receivedWakewords(data.wakeWords))
resolve(data)
})
}
}
}

View File

@@ -0,0 +1,13 @@
'use strict'
const {RECEIVE_WAKEWORDS} = require('./action_constants')
module.exports = (state = {}, action) => {
switch (action.type) {
case RECEIVE_WAKEWORDS:
return Object.assign({}, state, {
wakewords: action.wakewords
})
default:
return state
}
}

View File

@@ -0,0 +1,7 @@
'use strict'
module.exports = {
'/wakewords': (store, params, cb) => {
cb(store.getState().wakewords.wakewords)
}
}