import axios from 'axios'

export async function ipapi() {
	let apiData = sessionStorage.getItem('ipapi')
	if (!apiData) {
		apiData = (await axios.get('https://ipapi.co/json/')).data
		apiData = JSON.stringify(apiData)
		sessionStorage.setItem('ipapi', apiData)
	}
	return JSON.parse(apiData)
}
