import axios from 'axios'; const fetchTarget = async (target: string) => { return await axios.get(target, { maxRedirects: 0, validateStatus: (status) => { return status >= 300 && status < 400; }, }); }; export const getLocationOfTarget = async (target: string) => { try { const response = await fetchTarget(target); if (response.headers.location) { return response.headers.location as string; } } catch (err) { console.log(err); } return undefined; };