Added support for custom metadata providers

WiP but already open to feedback
This commit is contained in:
Barnabas Ratki 2024-01-03 01:36:56 +01:00
parent 8c6a2ac5dd
commit 8027c4a06f
14 changed files with 642 additions and 4 deletions

View file

@ -73,6 +73,33 @@ export const state = () => ({
export const getters = {}
export const actions = {}
export const actions = {
reFetchCustom({ dispatch, commit }) {
return this.$axios
.$get(`/api/custom-metadata-providers`)
.then((data) => {
const providers = data.providers
export const mutations = {}
commit('setCustomProviders', providers)
return data
})
.catch((error) => {
console.error('Failed', error)
return false
})
},
}
export const mutations = {
setCustomProviders(state, providers) {
// clear previous values, and add new values to the end
state.providers = state.providers.filter((p) => !p.value.startsWith("custom-"));
state.providers = [
...state.providers,
...providers.map((p) => {return {
text: p.name,
value: p.slug,
}})
]
},
}