- Api client before I blow my brains out
This commit is contained in:
14
client/api/ingredientsRepository.js
Normal file
14
client/api/ingredientsRepository.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import api from './api'
|
||||
|
||||
// URL for spells
|
||||
const resource = "/ingredients"
|
||||
|
||||
// CRUD methods for spells
|
||||
export default {
|
||||
getIngredients() {
|
||||
return api.get(`${resource}`)
|
||||
},
|
||||
getIngredient(id) {
|
||||
return api.get(`${resource}/${id}`)
|
||||
},
|
||||
}
|
||||
14
client/api/metaschoolsRepository.js
Normal file
14
client/api/metaschoolsRepository.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import api from './api'
|
||||
|
||||
// URL for spells
|
||||
const resource = "/meta_schools"
|
||||
|
||||
// CRUD methods for spells
|
||||
export default {
|
||||
getMetaSchools() {
|
||||
return api.get(`${resource}`)
|
||||
},
|
||||
getMetaSchool(id) {
|
||||
return api.get(`${resource}/${id}`)
|
||||
},
|
||||
}
|
||||
@@ -1,8 +1,16 @@
|
||||
import spellsRepository from './spellsRepository'
|
||||
import schoolsRepository from './schoolsRepository'
|
||||
import metaschoolsRepository from './metaschoolsRepository'
|
||||
import variablesRepository from './variablesRepository'
|
||||
import ingredientsRepository from './ingredientsRepository'
|
||||
|
||||
// List of possible repositories
|
||||
const repositories = {
|
||||
spells: spellsRepository
|
||||
spells: spellsRepository,
|
||||
schools: schoolsRepository,
|
||||
metaschools: metaschoolsRepository,
|
||||
variables: variablesRepository,
|
||||
ingredients: ingredientsRepository,
|
||||
}
|
||||
|
||||
// Usage : RepositoryFactoryInstance.get('reponame');
|
||||
|
||||
14
client/api/schoolsRepository.js
Normal file
14
client/api/schoolsRepository.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import api from './api'
|
||||
|
||||
// URL for spells
|
||||
const resource = "/schools"
|
||||
|
||||
// CRUD methods for spells
|
||||
export default {
|
||||
getSchools() {
|
||||
return api.get(`${resource}`)
|
||||
},
|
||||
getSchool(id) {
|
||||
return api.get(`${resource}/${id}`)
|
||||
},
|
||||
}
|
||||
@@ -11,4 +11,10 @@ export default {
|
||||
getSpell(id) {
|
||||
return api.get(`${resource}/${id}`)
|
||||
},
|
||||
addSpell(data) {
|
||||
return api.post(`${resource}`, data)
|
||||
},
|
||||
updateSpell(id, data) {
|
||||
return api.put(`${resource}/${id}`, data)
|
||||
}
|
||||
}
|
||||
14
client/api/variablesRepository.js
Normal file
14
client/api/variablesRepository.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import api from './api'
|
||||
|
||||
// URL for spells
|
||||
const resource = "/variables"
|
||||
|
||||
// CRUD methods for spells
|
||||
export default {
|
||||
getVariables() {
|
||||
return api.get(`${resource}`)
|
||||
},
|
||||
getVariable(id) {
|
||||
return api.get(`${resource}/${id}`)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user