make table observable query
This commit is contained in:
parent
dd6167aae8
commit
5cc4947399
|
@ -3,10 +3,16 @@ import database from '../db'
|
||||||
|
|
||||||
const profilesCollection = database.collections.get('profiles')
|
const profilesCollection = database.collections.get('profiles')
|
||||||
export const addProfile = async data => {
|
export const addProfile = async data => {
|
||||||
await database.action(async () => {
|
return await database.action(async () => {
|
||||||
const res = await profilesCollection.create(profile => {
|
const res = await profilesCollection.create(profile => {
|
||||||
const { addr, canceled, commitTime, type, name, url, idProfile } = data
|
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
|
return res
|
||||||
})
|
})
|
||||||
|
|
|
@ -53,5 +53,5 @@ const FunderProfilesTable = ({ cancelFundProfile, profiles }) => (
|
||||||
)
|
)
|
||||||
|
|
||||||
export default withDatabase(withObservables([], ({ database }) => ({
|
export default withDatabase(withObservables([], ({ database }) => ({
|
||||||
profiles: database.collections.get('profiles').query().fetch(),
|
profiles: database.collections.get('profiles').query().observe(),
|
||||||
}))(FunderProfilesTable))
|
}))(FunderProfilesTable))
|
||||||
|
|
Loading…
Reference in New Issue