|
@ -200,10 +200,6 @@ |
|
|
message="Received from" |
|
|
message="Received from" |
|
|
> |
|
|
> |
|
|
</GiftedDialog> |
|
|
</GiftedDialog> |
|
|
<AlertMessage |
|
|
|
|
|
:alertTitle="alertTitle" |
|
|
|
|
|
:alertMessage="alertMessage" |
|
|
|
|
|
></AlertMessage> |
|
|
|
|
|
</section> |
|
|
</section> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -226,10 +222,19 @@ import { |
|
|
import QuickNav from "@/components/QuickNav"; |
|
|
import QuickNav from "@/components/QuickNav"; |
|
|
import EntityIcon from "@/components/EntityIcon"; |
|
|
import EntityIcon from "@/components/EntityIcon"; |
|
|
|
|
|
|
|
|
|
|
|
interface Notification { |
|
|
|
|
|
group: string; |
|
|
|
|
|
type: string; |
|
|
|
|
|
title: string; |
|
|
|
|
|
text: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
components: { GiftedDialog, QuickNav, EntityIcon }, |
|
|
components: { GiftedDialog, QuickNav, EntityIcon }, |
|
|
}) |
|
|
}) |
|
|
export default class ProjectViewView extends Vue { |
|
|
export default class ProjectViewView extends Vue { |
|
|
|
|
|
$notify!: (notification: Notification, timeout?: number) => void; |
|
|
|
|
|
|
|
|
activeDid = ""; |
|
|
activeDid = ""; |
|
|
allMyDids: Array<string> = []; |
|
|
allMyDids: Array<string> = []; |
|
|
allContacts: Array<Contact> = []; |
|
|
allContacts: Array<Contact> = []; |
|
@ -339,7 +344,7 @@ export default class ProjectViewView extends Vue { |
|
|
this.longitude = resp.data.claim?.location?.geo?.longitude || 0; |
|
|
this.longitude = resp.data.claim?.location?.geo?.longitude || 0; |
|
|
} else if (resp.status === 404) { |
|
|
} else if (resp.status === 404) { |
|
|
// actually, axios throws an error so we never get here |
|
|
// actually, axios throws an error so we never get here |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -352,7 +357,7 @@ export default class ProjectViewView extends Vue { |
|
|
} catch (error: unknown) { |
|
|
} catch (error: unknown) { |
|
|
const serverError = error as AxiosError; |
|
|
const serverError = error as AxiosError; |
|
|
if (serverError.response?.status === 404) { |
|
|
if (serverError.response?.status === 404) { |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -362,7 +367,7 @@ export default class ProjectViewView extends Vue { |
|
|
-1, |
|
|
-1, |
|
|
); |
|
|
); |
|
|
} else { |
|
|
} else { |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -384,7 +389,7 @@ export default class ProjectViewView extends Vue { |
|
|
if (resp.status === 200 && resp.data.data) { |
|
|
if (resp.status === 200 && resp.data.data) { |
|
|
this.givesToThis = resp.data.data; |
|
|
this.givesToThis = resp.data.data; |
|
|
} else { |
|
|
} else { |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -396,7 +401,7 @@ export default class ProjectViewView extends Vue { |
|
|
} |
|
|
} |
|
|
} catch (error: unknown) { |
|
|
} catch (error: unknown) { |
|
|
const serverError = error as AxiosError; |
|
|
const serverError = error as AxiosError; |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -420,7 +425,7 @@ export default class ProjectViewView extends Vue { |
|
|
if (resp.status === 200 && resp.data.data) { |
|
|
if (resp.status === 200 && resp.data.data) { |
|
|
this.givesByThis = resp.data.data; |
|
|
this.givesByThis = resp.data.data; |
|
|
} else { |
|
|
} else { |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -432,7 +437,7 @@ export default class ProjectViewView extends Vue { |
|
|
} |
|
|
} |
|
|
} catch (error: unknown) { |
|
|
} catch (error: unknown) { |
|
|
const serverError = error as AxiosError; |
|
|
const serverError = error as AxiosError; |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -485,7 +490,7 @@ export default class ProjectViewView extends Vue { |
|
|
*/ |
|
|
*/ |
|
|
async recordGive(giverDid, description: string, hours: number) { |
|
|
async recordGive(giverDid, description: string, hours: number) { |
|
|
if (!this.activeDid) { |
|
|
if (!this.activeDid) { |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -498,7 +503,7 @@ export default class ProjectViewView extends Vue { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!description && !hours) { |
|
|
if (!description && !hours) { |
|
|
(this as any).$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -507,10 +512,7 @@ export default class ProjectViewView extends Vue { |
|
|
}, |
|
|
}, |
|
|
-1, |
|
|
-1, |
|
|
); |
|
|
); |
|
|
return; |
|
|
} else { |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
const result = await createAndSubmitGive( |
|
|
const result = await createAndSubmitGive( |
|
|
this.axios, |
|
|
this.axios, |
|
@ -522,10 +524,10 @@ export default class ProjectViewView extends Vue { |
|
|
hours, |
|
|
hours, |
|
|
this.projectId, |
|
|
this.projectId, |
|
|
); |
|
|
); |
|
|
|
|
|
if (result.type == "success") { |
|
|
if (result.status !== 201 || result.data?.error) { |
|
|
|
|
|
console.log("Error with give result:", result); |
|
|
console.log("Error with give result:", result); |
|
|
(this as any).$notify( |
|
|
if ("data" in result) { |
|
|
|
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
@ -536,8 +538,9 @@ export default class ProjectViewView extends Vue { |
|
|
}, |
|
|
}, |
|
|
-1, |
|
|
-1, |
|
|
); |
|
|
); |
|
|
} else { |
|
|
} |
|
|
(this as any).$notify( |
|
|
} else if (result.type == "error") { |
|
|
|
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "success", |
|
|
type: "success", |
|
@ -547,20 +550,6 @@ export default class ProjectViewView extends Vue { |
|
|
-1, |
|
|
-1, |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} catch (e) { |
|
|
|
|
|
console.log("Error with give caught:", e); |
|
|
|
|
|
(this as any).$notify( |
|
|
|
|
|
{ |
|
|
|
|
|
group: "alert", |
|
|
|
|
|
type: "danger", |
|
|
|
|
|
title: "Error", |
|
|
|
|
|
text: |
|
|
|
|
|
e?.userMessage || |
|
|
|
|
|
e?.response?.data?.error?.message || |
|
|
|
|
|
"There was an error recording the give.", |
|
|
|
|
|
}, |
|
|
|
|
|
-1, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|