Fix country selection

This commit is contained in:
Zachary
2024-11-12 09:53:12 +01:00
parent ddca5eb890
commit ae7057463a

View File

@@ -63,8 +63,8 @@
try { try {
const response = await fetch('/cdn-cgi/trace'); const response = await fetch('/cdn-cgi/trace');
const text = await response.text(); const text = await response.text();
const countryCodeMatch = text.match(/cf-ipcountry=(\w+)/); const countryCodeMatch = text.match(/loc=(\w+)/);
const countryCode = countryCodeMatch ? countryCodeMatch[1] : 'BE'; const countryCode = countryCodeMatch ? countryCodeMatch[1] : '';
selectedCountry = countriesList[countryCode] || ''; selectedCountry = countriesList[countryCode] || '';
daysOff = ptoData[countryCode] || 0; daysOff = ptoData[countryCode] || 0;
} catch (error) { } catch (error) {