Don't allow form submission unless connected and core

This commit is contained in:
2020-10-09 14:41:10 +02:00
parent 4ab5c3c372
commit c0ccf83061
2 changed files with 7 additions and 1 deletions
@@ -107,6 +107,9 @@ export default class AddReimbursementComponent extends Component {
@action @action
submit (e) { submit (e) {
e.preventDefault(); e.preventDefault();
if (!this.kredits.currentUser) { window.alert('You need to connect your Ethereum account first.'); return false }
if (!this.kredits.currentUserIsCore) { window.alert('Only core contributors can submit reimbursements.'); return false }
const contributor = this.contributors.findBy('id', this.contributorId); const contributor = this.contributors.findBy('id', this.contributorId);
const attributes = { const attributes = {
+4 -1
View File
@@ -594,7 +594,10 @@ export default Service.extend({
// Listen to tx mining/execution status // Listen to tx mining/execution status
data.wait() data.wait()
.then(d => console.debug('[kredits] tx successful', d)) .then(d => console.debug('[kredits] tx successful', d))
.catch(e => console.log('[kredits] tx error', e)); .catch(e => {
window.alert('The transaction failed to execute. Please check the browser console.');
console.log('[kredits] tx error', e);
});
return reimbursement; return reimbursement;
}); });