|
@ -21,9 +21,13 @@ const TopicCreate = (props) => { |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
|
|
|
breeze: { |
|
|
|
|
|
orbit: { |
|
|
|
|
|
stores, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
} = useContext(AppContext.Context); |
|
|
} = useContext(AppContext.Context); |
|
|
|
|
|
|
|
|
const orbit = useSelector((state) => state.orbit); |
|
|
|
|
|
const transactionStack = useSelector((state) => state.transactionStack); |
|
|
const transactionStack = useSelector((state) => state.transactionStack); |
|
|
const transactions = useSelector((state) => state.transactions); |
|
|
const transactions = useSelector((state) => state.transactions); |
|
|
|
|
|
|
|
@ -73,23 +77,26 @@ const TopicCreate = (props) => { |
|
|
}, |
|
|
}, |
|
|
} = transactions[transactionStack[createTopicCacheSendStackId]]; |
|
|
} = transactions[transactionStack[createTopicCacheSendStackId]]; |
|
|
|
|
|
|
|
|
// Promise.all( |
|
|
const topicsDb = Object.values(stores).find((store) => store.dbname === 'topics'); |
|
|
// orbit.topicsDB |
|
|
const postsDb = Object.values(stores).find((store) => store.dbname === 'posts'); |
|
|
// .put(topicId, { subject: subjectInput }), |
|
|
|
|
|
// orbit.postsDB |
|
|
topicsDb |
|
|
// .put(postId, { |
|
|
.put(topicId, { subject: subjectInput }) |
|
|
// subject: subjectInput, |
|
|
.then(() => postsDb |
|
|
// content: messageInput, |
|
|
.put(postId, { |
|
|
// }), |
|
|
subject: subjectInput, |
|
|
// ).then((value) => { |
|
|
content: messageInput, |
|
|
// console.log(value); |
|
|
})) |
|
|
// history.push('/'); |
|
|
.then(() => { |
|
|
// }) |
|
|
history.push(`/topics/${topicId}`); |
|
|
// .catch((reason) => console.log(reason)); |
|
|
}) |
|
|
|
|
|
.catch((reason) => { |
|
|
|
|
|
console.log(reason); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, [ |
|
|
}, [ |
|
|
transactions, transactionStack, history, posting, createTopicCacheSendStackId, orbit, subjectInput, messageInput, |
|
|
transactions, transactionStack, history, posting, createTopicCacheSendStackId, subjectInput, messageInput, stores, |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
const validateAndPost = useCallback(() => { |
|
|
const validateAndPost = useCallback(() => { |
|
|