make table observable query

This commit is contained in:
Barry Gitarts 2019-01-18 14:46:03 -05:00
parent dd6167aae8
commit 5cc4947399
2 changed files with 9 additions and 3 deletions

View File

@ -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
})

View File

@ -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))