bugfix: save record not wokring (wrong url)

This commit is contained in:
Michael Shanks 2020-05-28 10:45:59 +01:00
parent 5c3e514fd0
commit afa3e79147
3 changed files with 6 additions and 5 deletions

View File

@ -15,13 +15,13 @@ export async function createDatabase(appname, instanceName) {
}
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)
return response
}
export async function saveRecord(record, instanceId) {
const SAVE_RECORDS_URL = `/api/${instanceId}/records`
export async function saveRecord(record, instanceId, modelId) {
const SAVE_RECORDS_URL = `/api/${instanceId}/${modelId}/records`
const response = await api.post(SAVE_RECORDS_URL, record)
return await response.json()

View File

@ -42,7 +42,8 @@
...record,
modelId: $backendUiStore.selectedModel._id,
},
instanceId
instanceId,
$backendUiStore.selectedModel._id
)
if (recordResponse.errors) {
errors = recordResponse.errors

View File

@ -46,7 +46,7 @@
function selectModel(model) {
backendUiStore.update(state => {
state.selectedModel = model
state.selectedView = `all_${model._id}`
state.selectedView = `${model._id}`
return state
})
}