From 08febd4af237a0c44db6dedb83630afb6d088a77 Mon Sep 17 00:00:00 2001
From: Reallag <gurak369@seznam.cz>
Date: Sat, 10 Jun 2023 18:53:08 +0200
Subject: [PATCH] =?UTF-8?q?Podpora=20notifikac=C3=AD=20-=20uprava=20erroru?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 server/src/index.ts      |  4 +++-
 server/src/notifikace.ts | 14 ++++----------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/server/src/index.ts b/server/src/index.ts
index 78ae639..37e74c6 100644
--- a/server/src/index.ts
+++ b/server/src/index.ts
@@ -165,4 +165,6 @@ const HOST = process.env.HOST || '0.0.0.0';
 
 server.listen(PORT, () => {
     console.log(`Server listening on ${HOST}, port ${PORT}`);
-});
\ No newline at end of file
+});
+
+console.log(process.env.API_KEY)
\ No newline at end of file
diff --git a/server/src/notifikace.ts b/server/src/notifikace.ts
index 23a5f34..fe64f0e 100644
--- a/server/src/notifikace.ts
+++ b/server/src/notifikace.ts
@@ -4,7 +4,7 @@ import {NotififaceInput, NotifikaceData, UdalostEnum} from "./types";
 
 const url = 'your_URL_here'; // Place your URL here
 
-export const gotifyCall = async (data: NotififaceInput): Promise<AxiosResponse> => {
+export const gotifyCall = async (data: NotififaceInput): Promise<void> => {
 
     const options = {
         headers: {"Content-Type": "application/json"},
@@ -21,7 +21,7 @@ export const gotifyCall = async (data: NotififaceInput): Promise<AxiosResponse>
             success: true,
             message: "Notifikace doručena",
         };
-        return response;
+        console.log(response)
     } catch (error: unknown) {
         if (axios.isAxiosError(error)) {
             const axiosError = error as AxiosError;
@@ -30,17 +30,11 @@ export const gotifyCall = async (data: NotififaceInput): Promise<AxiosResponse>
                     success: false,
                     message: "fail",
                 };
-                return axiosError.response;
+                console.log(axiosError.response);
             }
         }
         // Handle unknown error without a response
-        return {
-            status: 500,
-            statusText: 'Unknown error',
-            headers: {}, // empty headers
-            data: {success: false, message: "fail"},
-            config: {}, // empty config
-        };
+        console.log("unkown error")
     }
 };