From bf1450799df0deb424a9675be89e13c29e3620d7 Mon Sep 17 00:00:00 2001
From: Mel <einebeere@gmail.com>
Date: Sat, 19 Feb 2022 20:00:38 +0100
Subject: Split state into stages to handle messages

---
 assets/src/components/share/Request.svelte | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

(limited to 'assets/src/components/share/Request.svelte')

diff --git a/assets/src/components/share/Request.svelte b/assets/src/components/share/Request.svelte
index e554bfe..40a62fc 100644
--- a/assets/src/components/share/Request.svelte
+++ b/assets/src/components/share/Request.svelte
@@ -1,12 +1,9 @@
 <script lang="ts">
-    import {
-        acceptIncomingRequest,
-        declineIncomingRequest,
-        IncomingRequestState,
-    } from "../../models/incoming_request";
+    import { IncomingRequestState } from "../../models/incoming_request";
     import type { IncomingRequest } from "../../models/incoming_request";
     import CheckIcon from "../icons/CheckIcon.svelte";
     import CloseIcon from "../icons/CloseIcon.svelte";
+    import { getShareState, Sharing } from "../../state/share";
 
     export let request: IncomingRequest;
     const state = request.state;
@@ -14,11 +11,13 @@
     const time = `${request.info.receivedAt.getHours()}:${request.info.receivedAt.getMinutes()}`;
 
     async function accept() {
-        acceptIncomingRequest(request);
+        const sharing = getShareState().state as Sharing;
+        sharing.acceptRequest(request);
     }
 
     function decline() {
-        declineIncomingRequest(request);
+        const sharing = getShareState().state as Sharing;
+        sharing.declineRequest(request);
     }
 </script>
 
-- 
cgit 1.4.1

