Skip to content

Commit

Permalink
Merge pull request #86 from solun-pm/dev
Browse files Browse the repository at this point in the history
Changed IP API Endpoint
  • Loading branch information
DanielWTE authored Nov 4, 2023
2 parents eee1ddf + c3f95c8 commit ca28d92
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
23 changes: 13 additions & 10 deletions app/ip/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const ipInformations = () => {
const [ipData, setIpData] = useState(null) as any;

useEffect(() => {
fetch('http://ip-api.com/json/')
fetch('https://ipapi.co/json/')
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
if (data) {
setIpData(data);
} else {
toast.error('Error while fetching IP informations');
Expand All @@ -41,24 +41,27 @@ return (
<div className="text-center mb-6">
<h2 className="text-2xl first-line:text-white">
IP Address: <br />
<span className="text-4xl text-blue-600 hover:text-blue-700 transition-all font-semibold">{ipData?.query || <LoadingPlaceholder />}</span>
<span className="text-4xl text-blue-600 hover:text-blue-700 transition-all font-semibold">{ipData?.ip || <LoadingPlaceholder />}</span>
</h2>
<h4 className="text-lg text-gray-400">
Network: <br />
<span className="text-2xl text-gray-500">{ipData?.network || <LoadingPlaceholder />}</span>
</h4>
</div>
<div className="text-white grid md:grid-cols-2 gap-4">
<div>
<p><strong>Country:</strong> {ipData?.country || <LoadingPlaceholder />} ({ipData?.countryCode || <LoadingPlaceholder />})</p>
<p><strong>Region:</strong> {ipData?.regionName || <LoadingPlaceholder />} ({ipData?.region || <LoadingPlaceholder />})</p>
<p><strong>City:</strong> {ipData?.city || <LoadingPlaceholder />} {ipData?.zip || <LoadingPlaceholder />}</p>
<p><strong>Country:</strong> {ipData?.country_name || <LoadingPlaceholder />} ({ipData?.country_code || <LoadingPlaceholder />})</p>
<p><strong>Region:</strong> {ipData?.region || <LoadingPlaceholder />}</p>
<p><strong>City:</strong> {ipData?.city || <LoadingPlaceholder />} {ipData?.postal || <LoadingPlaceholder />}</p>
</div>
<div>
<p><strong>Latitude:</strong> {ipData?.lat || <LoadingPlaceholder />}</p>
<p><strong>Longitude:</strong> {ipData?.lon || <LoadingPlaceholder />}</p>
<p><strong>Latitude:</strong> {ipData?.latitude || <LoadingPlaceholder />}</p>
<p><strong>Longitude:</strong> {ipData?.longitude || <LoadingPlaceholder />}</p>
<p><strong>Timezone:</strong> {ipData?.timezone || <LoadingPlaceholder />}</p>
</div>
<div className="md:col-span-2">
<p><strong>ISP:</strong> {ipData?.isp || <LoadingPlaceholder />}</p>
<p><strong>Organization:</strong> {ipData?.org || <LoadingPlaceholder />}</p>
<p><strong>AS:</strong> {ipData?.as || <LoadingPlaceholder />}</p>
<p><strong>ASN:</strong> {ipData?.asn || <LoadingPlaceholder />}</p>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solun",
"version": "0.3.9",
"version": "0.3.10",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down

0 comments on commit ca28d92

Please sign in to comment.