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