mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
improved plugin functionality
- added abiulity to extend default api router from plugion - added dability to pass custom model definition to generic model/api functions - added ability to pass custom API clients to generic API function
This commit is contained in:
@@ -76,7 +76,8 @@ export default {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
show: { required: true, type: Boolean, default: false },
|
||||
show: {required: true, type: Boolean, default: false},
|
||||
models: {required: false, type: Function, default: null}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -92,6 +93,10 @@ export default {
|
||||
mounted() {
|
||||
this.id = Math.random()
|
||||
this.$root.$on("change", this.storeValue) // bootstrap modal placed at document so have to listen at root of component
|
||||
|
||||
if (this.models !== null){
|
||||
this.Models = this.models // override models definition file with prop
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
advancedForm() {
|
||||
|
||||
0
vue/src/stores/GenericApiStore.js
Normal file
0
vue/src/stores/GenericApiStore.js
Normal file
@@ -311,7 +311,7 @@ export function calculateHourMinuteSplit(amount) {
|
||||
let minutes = amount - hours * 60
|
||||
let output_text = hours + " h"
|
||||
|
||||
if (minutes > 0){
|
||||
if (minutes > 0) {
|
||||
output_text += " " + minutes + " min"
|
||||
}
|
||||
|
||||
@@ -368,6 +368,9 @@ export const ApiMixin = {
|
||||
let func = setup.function
|
||||
let parameters = buildParams(options, setup)
|
||||
let apiClient = new ApiApiFactory()
|
||||
if (model.apiClient !== undefined) {
|
||||
apiClient = model.apiClient
|
||||
}
|
||||
return apiClient[func](...parameters)
|
||||
},
|
||||
genericGetAPI: function (url, options) {
|
||||
|
||||
Reference in New Issue
Block a user