Ver Fonte

fix format, unused vars

Paul Paffe há 2 anos atrás
pai
commit
fa648b1e00

+ 8 - 13
web/src/lib/components/shared-components/profile-image-cropper.svelte

@@ -1,20 +1,16 @@
 <script lang="ts">
   import { AssetResponseDto, api } from '@api';
-  import { createEventDispatcher, onMount } from 'svelte';
-  import Plus from 'svelte-material-icons/Plus.svelte';
+  import { createEventDispatcher } from 'svelte';
   import PhotoViewer from '../asset-viewer/photo-viewer.svelte';
   import BaseModal from './base-modal.svelte';
-  import { stringify } from 'postcss';
   import Button from '../elements/buttons/button.svelte';
   const dispatch = createEventDispatcher();
   export let asset: AssetResponseDto;
   export let publicSharedKey = '';
   import domtoimage from 'dom-to-image';
-  import type { UserResponseDto } from '@api';
   import { notificationController, NotificationType } from './notification/notification';
   import { lastUpdatedProfilePicture } from '$lib/stores/preferences.store';
 
-  let user: UserResponseDto;
   let profilePicture: HTMLDivElement;
 
   const handleSetProfilePicture = async () => {
@@ -22,14 +18,13 @@
     const blob: Blob = await domtoimage.toBlob(div);
     const file: File = new File([blob], 'profile-picture.png', { type: 'image/png' });
     try {
-      api.userApi.createProfileImage({ file }).then((res) => {
-        lastUpdatedProfilePicture.set(Date.now());
-        dispatch('close');
-        notificationController.show({
-          type: NotificationType.Info,
-          message: 'Profile picture set.',
-          timeout: 3000,
-        });
+      await api.userApi.createProfileImage({ file });
+      lastUpdatedProfilePicture.set(Date.now());
+      dispatch('close');
+      notificationController.show({
+        type: NotificationType.Info,
+        message: 'Profile picture set.',
+        timeout: 3000,
       });
     } catch (err) {
       console.error('Error [profile-image-cropper]:', err);

+ 1 - 3
web/src/lib/stores/preferences.store.ts

@@ -1,6 +1,5 @@
 import { browser } from '$app/environment';
 import { persisted } from 'svelte-local-storage-store';
-import { writable } from 'svelte/store';
 
 const initialTheme = browser && !window.matchMedia('(prefers-color-scheme: dark)').matches ? 'light' : 'dark';
 
@@ -48,5 +47,4 @@ export const albumViewSettings = persisted<AlbumViewSettings>('album-view-settin
   sortBy: 'Most recent photo',
 });
 
-
-export const lastUpdatedProfilePicture = persisted<Number>('last-updated-profile-picture', 0, {});
+export const lastUpdatedProfilePicture = persisted<number>('last-updated-profile-picture', 0, {});