bugfix: save record not wokring (wrong url)
This commit is contained in:
parent
5c3e514fd0
commit
afa3e79147
|
@ -15,13 +15,13 @@ export async function createDatabase(appname, instanceName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteRecord(record, instanceId) {
|
export async function deleteRecord(record, instanceId) {
|
||||||
const DELETE_RECORDS_URL = `/api/${instanceId}/records/${record._id}/${record._rev}`
|
const DELETE_RECORDS_URL = `/api/${instanceId}/${record._modelId}/records/${record._id}/${record._rev}`
|
||||||
const response = await api.delete(DELETE_RECORDS_URL)
|
const response = await api.delete(DELETE_RECORDS_URL)
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function saveRecord(record, instanceId) {
|
export async function saveRecord(record, instanceId, modelId) {
|
||||||
const SAVE_RECORDS_URL = `/api/${instanceId}/records`
|
const SAVE_RECORDS_URL = `/api/${instanceId}/${modelId}/records`
|
||||||
const response = await api.post(SAVE_RECORDS_URL, record)
|
const response = await api.post(SAVE_RECORDS_URL, record)
|
||||||
|
|
||||||
return await response.json()
|
return await response.json()
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
...record,
|
...record,
|
||||||
modelId: $backendUiStore.selectedModel._id,
|
modelId: $backendUiStore.selectedModel._id,
|
||||||
},
|
},
|
||||||
instanceId
|
instanceId,
|
||||||
|
$backendUiStore.selectedModel._id
|
||||||
)
|
)
|
||||||
if (recordResponse.errors) {
|
if (recordResponse.errors) {
|
||||||
errors = recordResponse.errors
|
errors = recordResponse.errors
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
function selectModel(model) {
|
function selectModel(model) {
|
||||||
backendUiStore.update(state => {
|
backendUiStore.update(state => {
|
||||||
state.selectedModel = model
|
state.selectedModel = model
|
||||||
state.selectedView = `all_${model._id}`
|
state.selectedView = `${model._id}`
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue