Podpora notifikací - uprava erroru
This commit is contained in:
parent
ae5d53bcf3
commit
08febd4af2
@ -166,3 +166,5 @@ const HOST = process.env.HOST || '0.0.0.0';
|
||||
server.listen(PORT, () => {
|
||||
console.log(`Server listening on ${HOST}, port ${PORT}`);
|
||||
});
|
||||
|
||||
console.log(process.env.API_KEY)
|
@ -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")
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user