update when linked field added
This commit is contained in:
parent
f1795d51ef
commit
ee86d6fb16
|
@ -50,6 +50,14 @@ export const getBackendUiStore = () => {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
models: {
|
models: {
|
||||||
|
fetch: async () => {
|
||||||
|
const modelsResponse = await api.get(`/api/models`)
|
||||||
|
const models = await modelsResponse.json()
|
||||||
|
store.update(state => {
|
||||||
|
state.models = models
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
},
|
||||||
select: model =>
|
select: model =>
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.selectedModel = model
|
state.selectedModel = model
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
.content {
|
.content {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
display: block;
|
display: block;
|
||||||
|
color: var(--white);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
function addField(blockDefinition) {
|
function addField(blockDefinition) {
|
||||||
backendUiStore.actions.models.addField(blockDefinition)
|
backendUiStore.actions.models.addField(blockDefinition)
|
||||||
|
backendUiStore.actions.models.fetch()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ exports.save = async function(ctx) {
|
||||||
|
|
||||||
// create links in other tables
|
// create links in other tables
|
||||||
for (let key in record) {
|
for (let key in record) {
|
||||||
if (Array.isArray(record[key])) {
|
if (model.schema[key].type === "link") {
|
||||||
const linked = await db.allDocs({
|
const linked = await db.allDocs({
|
||||||
include_docs: true,
|
include_docs: true,
|
||||||
keys: record[key],
|
keys: record[key],
|
||||||
|
|
Loading…
Reference in New Issue