Added alert for partner in app IO-406

This commit is contained in:
Patrick Fic
2021-02-22 17:05:12 -08:00
parent 6cdae6b0d5
commit 1a6e336e9a
7 changed files with 86 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
import React, { useState, useEffect } from "react";
import axios from "axios";
import { message, notification } from "antd";
import { useTranslation } from "react-i18next";
export default function PartnerPingComponent() {
const { t } = useTranslation();
useEffect(() => {
// Create an scoped async function in the hook
async function checkPartnerStatus() {
try {
const PartnerResponse = await axios.post("http://localhost:1337/ping/");
const { appver, qbpath } = PartnerResponse.data;
if (!qbpath) {
notification["error"]({
title: "",
message: t("general.messages.noacctfilepath"),
});
}
} catch (error) {
notification["error"]({
title: "",
message: t("general.messages.partnernotrunning"),
});
}
}
// Execute the created function directly
checkPartnerStatus();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return <></>;
}