feat(weather): change to freeipapi, move getApproxLocation to actions

This commit is contained in:
ItzCrazyKns
2026-03-26 22:34:01 +05:30
parent d16b7e271a
commit 72ac815294
3 changed files with 19 additions and 12 deletions

View File

@@ -1,5 +1,8 @@
import { Cloud, Sun, CloudRain, CloudSnow, Wind } from 'lucide-react';
'use client';
import { Wind } from 'lucide-react';
import { useEffect, useState } from 'react';
import { getApproxLocation } from '@/lib/actions';
const WeatherWidget = () => {
const [data, setData] = useState({
@@ -15,17 +18,6 @@ const WeatherWidget = () => {
const [loading, setLoading] = useState(true);
const getApproxLocation = async () => {
const res = await fetch('https://ipwhois.app/json/');
const data = await res.json();
return {
latitude: data.latitude,
longitude: data.longitude,
city: data.city,
};
};
const getLocation = async (
callback: (location: {
latitude: number;