mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2026-04-16 08:44:29 +00:00
feat(weather): change to freeipapi, move getApproxLocation to actions
This commit is contained in:
@@ -20,3 +20,17 @@ export const getSuggestions = async (chatHistory: [string, string][]) => {
|
||||
|
||||
return data.suggestions;
|
||||
};
|
||||
|
||||
export const getApproxLocation = async () => {
|
||||
const res = await fetch('https://free.freeipapi.com/api/json', {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
return {
|
||||
latitude: data.latitude,
|
||||
longitude: data.longitude,
|
||||
city: data.cityName,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user