Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
notkaramel
left a comment
There was a problem hiding this comment.
Great work! We will keep a similar framework for other pages soon!
src/routes/+page.server.ts
Outdated
| "logo": logo.asset->url+"?h=100&fm=webp" | ||
| } | ||
| }, | ||
| "_lastUpdated": *[_type=="officeHours"] | order(_updatedAt desc)[0]._updatedAt |
There was a problem hiding this comment.
Since we're renaming the variable, you can change "_lastUpdated" to a more descriptive name. I suggest "ohLastUpdated" and also put it between Line 17 and 18 so it's next to the fetching OH query.
ECSESS/src/routes/+page.server.ts
Lines 9 to 18 in 9b93464
Great use of the pipe/order functions! I didn't know Sanity can do that
src/routes/+page.server.ts
Outdated
| sponsors: sponsorsResp, | ||
| canonical: url.href | ||
| canonical: url.href, | ||
| ohLastUpdated: homePageResp._lastUpdated ?? null |
There was a problem hiding this comment.
Maybe you can do the time formatting/casting on the backend (this .server file)?
// What you currently have on the frontend
{new Date(data.ohLastUpdated).toLocaleString()}
// What I'm thinking the frontend should have
{data.ohLastUpdated}Functionality wise it's the same, but the frontend just have to get the value.
There was a problem hiding this comment.
that i've been doubting.. how to do formatting from the backend, u could check the newest version rn
There was a problem hiding this comment.
You can add a line that creates new Date() after getting the homePageRepsonse, and return the value in the return block.
By "backend" I meant the page.server.ts file, sorry for the confusion
Related to #91
_lastUpdatedby querying theupdatedAtfield and reordering it.