From 5cc4947399ce39568b57a7db9875cc5eaa4b5157 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Fri, 18 Jan 2019 14:46:03 -0500 Subject: [PATCH] make table observable query --- app/actions/profiles.js | 10 ++++++++-- app/components/FunderProfilesTable.jsx | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/actions/profiles.js b/app/actions/profiles.js index f07f0c4..cc639f8 100644 --- a/app/actions/profiles.js +++ b/app/actions/profiles.js @@ -3,10 +3,16 @@ import database from '../db' const profilesCollection = database.collections.get('profiles') export const addProfile = async data => { - await database.action(async () => { + return await database.action(async () => { const res = await profilesCollection.create(profile => { const { addr, canceled, commitTime, type, name, url, idProfile } = data - //TODO add assignemnts + profile.addr = addr + profile.canceled = canceled + profile.commitTime = Number(commitTime) + profile.type = type + profile.name = name + profile.url = url + profile.idProfile = Number(idProfile) }) return res }) diff --git a/app/components/FunderProfilesTable.jsx b/app/components/FunderProfilesTable.jsx index 7a32b23..5b958b6 100644 --- a/app/components/FunderProfilesTable.jsx +++ b/app/components/FunderProfilesTable.jsx @@ -53,5 +53,5 @@ const FunderProfilesTable = ({ cancelFundProfile, profiles }) => ( ) export default withDatabase(withObservables([], ({ database }) => ({ - profiles: database.collections.get('profiles').query().fetch(), + profiles: database.collections.get('profiles').query().observe(), }))(FunderProfilesTable))