diff --git a/client/src/components/CollectQuote.vue b/client/src/components/CollectQuote.vue index e8ae3c8..4646def 100644 --- a/client/src/components/CollectQuote.vue +++ b/client/src/components/CollectQuote.vue @@ -20,11 +20,12 @@ export default { }, save() { console.log('save') - this.$engine.saveQuote(":new:", this.quote.quote) + // this.$engine.createQuote(this.quote.quote) + // this.$engine.saveQuote(this.quote.id, this.quote.quote) + // this.$engine.removeQuote(this.quote.id) }, remove() { console.log('remove') - this.$engine.removeQuote(this.quote.id) }, }, } diff --git a/client/src/plugins/engine/createQuote.js b/client/src/plugins/engine/createQuote.js new file mode 100644 index 0000000..5b7e180 --- /dev/null +++ b/client/src/plugins/engine/createQuote.js @@ -0,0 +1,9 @@ +export default async function(quote) { + const { store } = this.context + + await this.callApi('/api/saveQuote', { + g: store.state.engine.user?.game, + id: ':new:', + quote, + }) +} diff --git a/client/src/plugins/engine/index.js b/client/src/plugins/engine/index.js index 58ad8d5..1029b65 100644 --- a/client/src/plugins/engine/index.js +++ b/client/src/plugins/engine/index.js @@ -12,6 +12,7 @@ import parseSyncData from './parseSyncData' import saveSelection from './saveSelection' import getMyQuotes from './getMyQuotes' import saveQuote from './saveQuote' +import createQuote from './createQuote' import removeQuote from './removeQuote' export default (context, inject) => { @@ -29,6 +30,7 @@ export default (context, inject) => { collectQuotes, getMyQuotes, saveQuote, + createQuote, removeQuote, startGame, resetGame,