|
|
@ -179,6 +179,18 @@ |
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
--> |
|
|
|
|
|
|
|
<!-- This same popup code is in many files. --> |
|
|
|
<div v-bind:class="computedAlertClassNames()"> |
|
|
|
<button |
|
|
|
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2" |
|
|
|
@click="onClickClose()" |
|
|
|
> |
|
|
|
<fa icon="xmark"></fa> |
|
|
|
</button> |
|
|
|
<h4 class="font-bold pr-5">{{ alertTitle }}</h4> |
|
|
|
<p>{{ alertMessage }}</p> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
</template> |
|
|
|
|
|
|
@ -318,6 +330,12 @@ export default class ProjectViewView extends Vue { |
|
|
|
"You must select an identity before you can record a give."; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!description && !hours) { |
|
|
|
this.alertTitle = "Error"; |
|
|
|
this.alertMessage = |
|
|
|
"You must enter a description or some number of hours."; |
|
|
|
return; |
|
|
|
} |
|
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
|
const account = R.find((acc) => acc.did === this.activeDid, accounts); |
|
|
|
const identity = JSON.parse(account?.identity || "null"); |
|
|
@ -339,7 +357,8 @@ export default class ProjectViewView extends Vue { |
|
|
|
console.log("Error with give result:", result); |
|
|
|
this.alertTitle = "Error"; |
|
|
|
this.alertMessage = |
|
|
|
result.data?.message || "There was an error recording the give."; |
|
|
|
result.data?.error?.message || |
|
|
|
"There was an error recording the give."; |
|
|
|
} else { |
|
|
|
this.alertTitle = "Success"; |
|
|
|
this.alertMessage = "That gift was recorded."; |
|
|
@ -347,10 +366,13 @@ export default class ProjectViewView extends Vue { |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
// axios throws errors on 400 responses |
|
|
|
console.log("Error with give caught:", e); |
|
|
|
this.alertTitle = "Error"; |
|
|
|
this.alertMessage = |
|
|
|
e.userMessage || "There was an error recording the give."; |
|
|
|
e.userMessage || |
|
|
|
e.response?.data?.error?.message || |
|
|
|
"There was an error recording the give."; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|