data endpoint for entity 90008 (aka. a website)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: fetch guestbook entries after posting an entry

dusk b3ae288f af1cdcab

+6 -10
+6 -10
src/routes/guestbook/+page.server.ts
··· 85 85 getRatelimited: false, 86 86 fillText: fancyText(getVisitorId(cookies) ?? nanoid()) 87 87 }; 88 - let refetchEntries = data.entries.length === 0; 89 88 const rawPostData = scopedCookies.get('postData') || null; 90 89 const postAuth = scopedCookies.get('postAuth') || null; 91 90 if (rawPostData !== null && postAuth !== null) { ··· 121 120 }, 122 121 { resolveFacets: false } 123 122 ); 124 - refetchEntries = true; 123 + try { 124 + data.entries = await _fetchEntries(); 125 + // eslint-disable-next-line @typescript-eslint/no-explicit-any 126 + } catch (err: any) { 127 + data.getError = err.toString(); 128 + } 125 129 // eslint-disable-next-line @typescript-eslint/no-explicit-any 126 130 } catch (err: any) { 127 131 scopedCookies.set('sendError', err.toString()); ··· 132 136 // delete the cookies after we get em since we dont really need these more than once 133 137 scopedCookies.delete('sendError'); 134 138 scopedCookies.delete('sendRatelimited'); 135 - if (refetchEntries) { 136 - try { 137 - data.entries = await _fetchEntries(); 138 - // eslint-disable-next-line @typescript-eslint/no-explicit-any 139 - } catch (err: any) { 140 - data.getError = err.toString(); 141 - } 142 - } 143 139 144 140 return data; 145 141 }