From 7e4a2e3e3a45f0dd302ab3b0e3ac49ad7189eba4 Mon Sep 17 00:00:00 2001
From: Daniel Weipert <code@drogueronin.de>
Date: Tue, 7 Nov 2023 23:47:37 +0100
Subject: Update

---
 app/src/pages/Steps/2-To.vue | 57 +++++++++++++++++---------------------------
 1 file changed, 22 insertions(+), 35 deletions(-)

(limited to 'app/src/pages/Steps/2-To.vue')

diff --git a/app/src/pages/Steps/2-To.vue b/app/src/pages/Steps/2-To.vue
index 1cce01d..1b0c655 100644
--- a/app/src/pages/Steps/2-To.vue
+++ b/app/src/pages/Steps/2-To.vue
@@ -6,7 +6,7 @@
 
     <h1>To</h1>
 
-    <Panel v-model="to" @connect="connect" />
+    <Panel v-model="store.to" @connect="connect" />
 
     <router-link to="/steps/3">
       next
@@ -14,38 +14,25 @@
   </div>
 </template>
 
-<script>import Panel from '~/components/Panel';
-
-export default {
-  components: {
-    Panel,
-  },
-
-  computed: {
-    to: {
-      set (value) {
-        this.$store.commit('setTo', value);
-      },
-      get () {
-        return this.$store.state.to;
-      },
-    },
-  },
-
-  mounted () {
-    this.$electron.ipcRenderer.on('imap:listTree:to:reply', (event, folders) => {
-      this.to.folders = folders;
-    });
-
-    this.$electron.ipcRenderer.on('imap:to:error', (event, error) => {
-      this.to.error = error;
-    });
-  },
-
-  methods: {
-    connect () {
-      this.$electron.ipcRenderer.send('imap:listTree:to', JSON.parse(JSON.stringify(this.to)));
-    },
-  },
-};
+<script setup>
+import { inject, onMounted } from 'vue';
+import { useStore } from '~/store';
+import Panel from '~/components/Panel';
+
+const $electron = inject('electron');
+const store = useStore();
+
+function connect() {
+  $electron.ipcRenderer.send('imap:listTree:to', JSON.parse(JSON.stringify(store.to)));
+}
+
+onMounted(() => {
+  $electron.ipcRenderer.on('imap:listTree:to:reply', (_event, folders) => {
+    store.to.folders = folders;
+  });
+
+  $electron.ipcRenderer.on('imap:to:error', (_event, error) => {
+    store.to.error = error;
+  });
+});
 </script>
-- 
cgit v1.2.3

