fix: Use kebab-case for check license file

This commit is contained in:
Faruk AYDIN
2023-02-17 22:41:39 +01:00
parent 7c394414d8
commit d227a07fe9
2 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
import axios from 'axios';
import appConfig from '../config/app';
import memoryCache from 'memory-cache';
const CACHE_DURATION = 1000 * 60 * 60 * 24; // 24 hours in milliseconds
const checkLicense = async () => {
const licenseKey = appConfig.licenseKey;
if (!licenseKey) {
return false;
}
const url = 'https://license.automatisch.io/api/v1/licenses/verify';
const cachedResponse = memoryCache.get(url);
if (cachedResponse) {
return cachedResponse;
} else {
try {
const { data } = await axios.post(url, { licenseKey });
memoryCache.put(url, data.verified, CACHE_DURATION);
return data.verified;
} catch (error) {
return false;
}
}
};
export default checkLicense;