|  | @ -35,6 +35,7 @@ | 
			
		
	
		
		
			
				
					|  |  |             Cancel |  |  |             Cancel | 
			
		
	
		
		
			
				
					|  |  |           </button> |  |  |           </button> | 
			
		
	
		
		
			
				
					|  |  |         </div> |  |  |         </div> | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         <PhotoDialog ref="photoDialog" /> | 
			
		
	
		
		
			
				
					|  |  |       </div> |  |  |       </div> | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |       <div class="flex justify-center"> |  |  |       <div class="flex justify-center"> | 
			
		
	
	
		
		
			
				
					|  | @ -52,8 +53,10 @@ | 
			
		
	
		
		
			
				
					|  |  | </template> |  |  | </template> | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | <script lang="ts"> |  |  | <script lang="ts"> | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import axios from "axios"; | 
			
		
	
		
		
			
				
					|  |  | import { Component, Vue } from "vue-facing-decorator"; |  |  | import { Component, Vue } from "vue-facing-decorator"; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import PhotoDialog from "@/components/PhotoDialog.vue"; | 
			
		
	
		
		
			
				
					|  |  | import QuickNav from "@/components/QuickNav.vue"; |  |  | import QuickNav from "@/components/QuickNav.vue"; | 
			
		
	
		
		
			
				
					|  |  | import { |  |  | import { | 
			
		
	
		
		
			
				
					|  |  |   DEFAULT_IMAGE_API_SERVER, |  |  |   DEFAULT_IMAGE_API_SERVER, | 
			
		
	
	
		
		
			
				
					|  | @ -64,9 +67,8 @@ import { db } from "@/db/index"; | 
			
		
	
		
		
			
				
					|  |  | import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; |  |  | import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; | 
			
		
	
		
		
			
				
					|  |  | import { getIdentity } from "@/libs/util"; |  |  | import { getIdentity } from "@/libs/util"; | 
			
		
	
		
		
			
				
					|  |  | import { accessToken } from "@/libs/crypto"; |  |  | import { accessToken } from "@/libs/crypto"; | 
			
		
	
		
		
			
				
					|  |  | import axios from "axios"; |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  | @Component({ components: { QuickNav } }) |  |  | @Component({ components: { PhotoDialog, QuickNav } }) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | export default class SharedPhotoView extends Vue { |  |  | export default class SharedPhotoView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |   $notify!: (notification: NotificationIface, timeout?: number) => void; |  |  |   $notify!: (notification: NotificationIface, timeout?: number) => void; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -123,15 +125,19 @@ export default class SharedPhotoView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |     }); |  |  |     }); | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |   async recordProfile() { |  |  |   recordProfile() { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |     await this.sendToImageServer(IMAGE_TYPE_PROFILE).then((url) => { |  |  |     (this.$refs.photoDialog as PhotoDialog).open( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |       if (url) { |  |  |       async (imgUrl) => { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |         db.settings.update(MASTER_SETTINGS_KEY, { |  |  |         db.settings.update(MASTER_SETTINGS_KEY, { | 
			
		
	
		
		
			
				
					
					|  |  |           profileImageUrl: url, |  |  |           profileImageUrl: imgUrl, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					|  |  |         this.$router.push({ name: "account" }); |  |  |         this.$router.push({ name: "account" }); | 
			
		
	
		
		
			
				
					
					|  |  |       } |  |  |       }, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |     }); |  |  |       true, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |       IMAGE_TYPE_PROFILE, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       this.imageBlob, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       this.imageFileName, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     ); | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |   async cancel() { |  |  |   async cancel() { | 
			
		
	
	
		
		
			
				
					|  | @ -159,16 +165,37 @@ export default class SharedPhotoView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |       ); |  |  |       ); | 
			
		
	
		
		
			
				
					|  |  |       formData.append("claimType", imageType); |  |  |       formData.append("claimType", imageType); | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       console.log( | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         "Sending image to server", | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         formData, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         headers, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         DEFAULT_IMAGE_API_SERVER + "/image", | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       ); | 
			
		
	
		
		
			
				
					|  |  |       const response = await axios.post( |  |  |       const response = await axios.post( | 
			
		
	
		
		
			
				
					|  |  |         DEFAULT_IMAGE_API_SERVER + "/image", |  |  |         DEFAULT_IMAGE_API_SERVER + "/image", | 
			
		
	
		
		
			
				
					|  |  |         formData, |  |  |         formData, | 
			
		
	
		
		
			
				
					|  |  |         { headers }, |  |  |         { headers }, | 
			
		
	
		
		
			
				
					|  |  |       ); |  |  |       ); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       if (response?.data?.url) { | 
			
		
	
		
		
			
				
					|  |  |         this.imageBlob = undefined; |  |  |         this.imageBlob = undefined; | 
			
		
	
		
		
			
				
					|  |  |         this.imageFileName = undefined; |  |  |         this.imageFileName = undefined; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         result = response.data.url as string; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       } else { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         console.error("Problem uploading the image", response.data); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         this.$notify( | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             group: "alert", | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             type: "danger", | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             title: "Error", | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             text: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |               "There was a problem saving the picture. " + | 
			
		
	
		
		
			
				
					|  |  |  |  |  |               (response?.data?.message || ""), | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           }, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           5000, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         ); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |       this.uploading = false; |  |  |       this.uploading = false; | 
			
		
	
		
		
			
				
					|  |  |       result = response.data.url as string; |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } catch (error) { |  |  |     } catch (error) { | 
			
		
	
		
		
			
				
					|  |  |       console.error("Error uploading the image", error); |  |  |       console.error("Error uploading the image", error); | 
			
		
	
		
		
			
				
					|  |  |       this.$notify( |  |  |       this.$notify( | 
			
		
	
	
		
		
			
				
					|  | @ -176,7 +203,7 @@ export default class SharedPhotoView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |           group: "alert", |  |  |           group: "alert", | 
			
		
	
		
		
			
				
					|  |  |           type: "danger", |  |  |           type: "danger", | 
			
		
	
		
		
			
				
					|  |  |           title: "Error", |  |  |           title: "Error", | 
			
		
	
		
		
			
				
					
					|  |  |           text: "There was an error saving the picture. Please try again.", |  |  |           text: "There was an error saving the picture.", | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         }, |  |  |         }, | 
			
		
	
		
		
			
				
					|  |  |         5000, |  |  |         5000, | 
			
		
	
		
		
			
				
					|  |  |       ); |  |  |       ); | 
			
		
	
	
		
		
			
				
					|  | 
 |