Closed TheWoodenMan closed 2 years ago
Do we want to fetch the title when the link is submitted or when the link is called? If we're fetching the page's title on submission, I believe we would have to store it in the database to call it later. I think both options are fine but storing the title would mean a slight alteration to our tab schema
I think it's better to grab the title only when the link is submitted, committing it to the mongodb. I think you're right we'd have to update our schema. (links or tabs haven't had a look yet but will do tomorrow.)
That way we cut down on the number of external fetch requests and any kind of timing issues with waiting for promises while users are active.
I'm going to try and do this one today.
When a new link is submitted to the model it should "grab" (fetch) the header from a site take the title and the link and add all that to mongodb - then refresh.
afaik a basic fetch should be able to do this.
https://stackoverflow.com/questions/71482334/how-can-i-fetch-data-from-a-url-using-javascript