feat: add license info in getAutomatischInfo query (#1202)

This commit is contained in:
Ömer Faruk Aydın
2023-08-10 23:18:10 +02:00
committed by GitHub
parent ec42446daa
commit 84b701747f
4 changed files with 31 additions and 8 deletions

View File

@@ -5,7 +5,13 @@ import memoryCache from 'memory-cache';
const CACHE_DURATION = 1000 * 60 * 60 * 24; // 24 hours in milliseconds
const checkLicense = async () => {
const hasValidLicense = async () => {
const license = await getLicense();
return license ? true : false;
};
const getLicense = async () => {
const licenseKey = appConfig.licenseKey;
if (!licenseKey) {
@@ -20,13 +26,13 @@ const checkLicense = async () => {
} else {
try {
const { data } = await axios.post(url, { licenseKey });
memoryCache.put(url, data.verified, CACHE_DURATION);
memoryCache.put(url, data, CACHE_DURATION);
return data.verified;
return data;
} catch (error) {
return false;
}
}
};
export default checkLicense;
export { getLicense, hasValidLicense };