add station info api

This commit is contained in:
DJ2LS 2024-05-01 12:38:02 +02:00
parent a281fe6d65
commit 38427429dd

View file

@ -118,9 +118,25 @@ watch(
},
);
const stationInfo = ref({});
const stationInfo = ref({
callsign: 'N/A', // Default value for callsign
location: {
gridsquare: 'N/A', // Default value for gridsquare
},
});
async function getStationInfoByCallsign(){
stationInfo.value = await getStationInfo(chat.selectedCallsign);
try {
const data = await getStationInfo(chat.selectedCallsign);
stationInfo.value = {
callsign: data.callsign || 'N/A', // Default if not present
location: {
gridsquare: data.location?.gridsquare || 'N/A', // Default if not present
},
};
} catch (error) {
console.error("Error fetching station info:", error);
}
}