Skip to content

Commit 17addab

Browse files
authoredFeb 18, 2025
Added Sanity headless CMS (#41)
1 parent 691e176 commit 17addab

File tree

79 files changed

+1661
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1661
-84
lines changed
 

‎next.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const nextConfig = {
3030
*/
3131
config.module.rules.push(
3232
{
33-
test: /\.(vert|frag)$/i,
33+
test: /\.(vert|frag|groq)$/i,
3434
// More information here https://webpack.js.org/guides/asset-modules/
3535
type: 'asset/source',
3636
},
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { basePath } from '@/config';
2+
3+
export default async function subscribeNewsletterHandler({
4+
email,
5+
name,
6+
}: {
7+
email: string;
8+
name: string;
9+
}) {
10+
const response = await fetch(`${basePath}/api/newsletter`, {
11+
method: 'post',
12+
headers: {
13+
'Content-Type': 'application/json',
14+
},
15+
body: JSON.stringify({ email, name }),
16+
});
17+
const result = await response.json();
18+
if (response.ok) {
19+
return { subscribed: true, message: result.message };
20+
}
21+
throw Error(result.message, { cause: result });
22+
}

0 commit comments

Comments
 (0)