diff --git a/packages/builder/src/components/database/ModelDataTable/api.js b/packages/builder/src/components/database/ModelDataTable/api.js index a0f3105397..d35348b180 100644 --- a/packages/builder/src/components/database/ModelDataTable/api.js +++ b/packages/builder/src/components/database/ModelDataTable/api.js @@ -27,8 +27,8 @@ export async function loadRecord(key, { appname, instanceId }) { return await response.json() } -export async function saveRecord({ record, instanceId, modelId }) { - const SAVE_RECORDS_URL = `/api/${instanceId}/${modelId}/records` +export async function saveRecord(record, instanceId) { + const SAVE_RECORDS_URL = `/api/${instanceId}/records` const response = await api.post(SAVE_RECORDS_URL, record) return await response.json() } diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte index 380442fa71..90755da980 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -43,19 +43,22 @@ } async function saveRecord() { - const recordResponse = await api.saveRecord({ - record, - instanceId, - modelId: $backendUiStore.selectedModel._id - }) + const recordResponse = await api.saveRecord( + { + ...record, + modelId: $backendUiStore.selectedModel._id, + }, + instanceId + ) if (recordResponse.errors) { - errors = recordResponse.errors; - return; + errors = recordResponse.errors + return } backendUiStore.update(state => { state.selectedView = state.selectedView return state + onClosed(); }) } diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte index 28e396d5c3..7d1037fce3 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte @@ -14,7 +14,6 @@ async function createUser() { const user = { name: username, username, password } const response = await api.createUser(user, instanceId); - console.log(response); backendUiStore.actions.users.create(response) onClosed() } @@ -22,11 +21,14 @@