import fetch from 'node-fetch'; import { unix, get_credentials } from '../util.mjs'; export const update_last_scraped = async (place, prod = false) => { const { api, token } = get_credentials(prod); let res = await fetch(`${api}/places/${place.id}/?token=${token}`, { method: 'PATCH', body: JSON.stringify({ last_scraped: unix(new Date()) }), headers: { 'Content-Type': 'application/json' } }); if (res.ok) { console.log(res.status, `Last scrape at ${place.name} updated.`); } else { console.log( res.status, `Last scrape at ${place.name} failed to update last update..` ); } };