This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FormData } from '@/components/contact'; | |
| export function sendEmail(data: FormData) { | |
| const apiEndpoint = '/api/email'; | |
| fetch(apiEndpoint, { | |
| method: 'POST', | |
| body: JSON.stringify(data), | |
| }) | |
| .then((res) => res.json()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { type NextRequest, NextResponse } from 'next/server'; | |
| import nodemailer from 'nodemailer'; | |
| import Mail from 'nodemailer/lib/mailer'; | |
| export async function POST(request: NextRequest) { | |
| const { email, name, message } = await request.json(); | |
| const transport = nodemailer.createTransport({ | |
| service: 'gmail', | |
| /* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FormData } from '@/components/contact'; | |
| export function sendEmail(data: FormData) { | |
| // TODO: send email | |
| console.log(data); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use client'; | |
| import { FC } from 'react'; | |
| import { useForm } from 'react-hook-form'; | |
| import { sendEmail } from '@/utils/send-email'; | |
| export type FormData = { | |
| name: string; | |
| email: string; | |
| message: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Contact from '@/components/contact'; | |
| export default function Home() { | |
| return ( | |
| <main className='flex min-h-screen flex-col items-center justify-center p-24 bg-white'> | |
| <Contact /> | |
| </main> | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Head from "next/head"; | |
| import { NextPage } from "next"; | |
| import Link from "next/link"; | |
| import { usePbAuth } from "../contexts/AuthWrapper"; | |
| const Home: NextPage = () => { | |
| const { user, signOut } = usePbAuth(); | |
| return ( | |
| <> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Head from "next/head"; | |
| import { NextPage } from "next"; | |
| import { useRouter } from "next/router"; | |
| import { useEffect } from "react"; | |
| import type { AuthProviderInfo, Record as PbRecord } from "pocketbase"; | |
| import pb from "../lib/pocketbase"; | |
| import { usePbAuth } from "../contexts/AuthWrapper"; | |
| const SignIn: NextPage = () => { | |
| const { googleSignIn, githubSignIn, setUserData } = usePbAuth(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import "../styles/globals.css"; | |
| import type { AppProps } from "next/app"; | |
| import AuthWrapper from "../contexts/AuthWrapper"; | |
| export default function App({ Component, pageProps }: AppProps) { | |
| return ( | |
| <AuthWrapper> | |
| <Component {...pageProps} /> | |
| </AuthWrapper> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| createContext, | |
| FC, | |
| ReactNode, | |
| useContext, | |
| useEffect, | |
| useState, | |
| } from "react"; | |
| import { useRouter } from "next/router"; | |
| import pb from "../lib/pocketbase"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import PocketBase from "pocketbase"; | |
| const pb = new PocketBase(process.env.NEXT_PUBLIC_PB_URL); | |
| if (process.env.NODE_ENV === "development") pb.autoCancellation(false); | |
| export default pb; |