Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app/actions/verify.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"use server";

import { cookies } from "next/headers";
import { nanoid } from "nanoid";
import { cookies } from "next/headers";

export async function getNonce() {
try {
const nonce = nanoid(32);
const cookieStore = await cookies();

cookies().set("siwe_nonce", nonce, {
await cookieStore.set("siwe_nonce", nonce, {
secure: true,
httpOnly: true,
sameSite: "strict",
Expand All @@ -23,7 +24,8 @@ export async function getNonce() {

export async function verifyNonceCookie(submittedNonce: string) {
try {
const storedNonce = cookies().get("siwe_nonce")?.value;
const cookieStore = await cookies();
const storedNonce = cookieStore.get("siwe_nonce")?.value;

if (!storedNonce) {
return { isValid: false, error: "No nonce found in cookies" };
Expand All @@ -32,7 +34,8 @@ export async function verifyNonceCookie(submittedNonce: string) {
const isValid = storedNonce === submittedNonce;

if (isValid) {
cookies().delete("siwe_nonce");
const cookieStore = await cookies();
await cookieStore.delete("siwe_nonce");
}

return { isValid };
Expand Down
34 changes: 14 additions & 20 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Metadata } from "next";
import "./globals.css";
import MiniKitProvider from "@/components/minikit-provider";
import dynamic from "next/dynamic";
import { ReactQueryClientProvider } from "@/components/react-query-client-provider";
import { AuthProvider } from "@/context/AuthContext";
import { FetchPatchProvider } from "@/lib/FetchPatchProvider";
import { ReactQueryClientProvider } from "@/components/react-query-client-provider";
import type { Metadata } from "next";
import ErudaWrapper from "../components/ErudaWrapper";
import "./globals.css";

export const metadata: Metadata = {
title: "WorldView - Voting App",
Expand All @@ -16,25 +16,19 @@ export default function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {
const ErudaProvider = dynamic(
() => import("../components/Eruda").then((c) => c.ErudaProvider),
{
ssr: false,
}
);
return (
<html lang="en">
<body>
<ErudaProvider>
<MiniKitProvider>
<AuthProvider>
<ReactQueryClientProvider>
<FetchPatchProvider />
{children}
</ReactQueryClientProvider>
</AuthProvider>
</MiniKitProvider>
</ErudaProvider>
<ErudaWrapper>
<MiniKitProvider>
<AuthProvider>
<ReactQueryClientProvider>
<FetchPatchProvider />
{children}
</ReactQueryClientProvider>
</AuthProvider>
</MiniKitProvider>
</ErudaWrapper>
</body>
</html>
);
Expand Down
14 changes: 14 additions & 0 deletions components/ErudaWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use client';

import dynamic from 'next/dynamic';

const ErudaProvider = dynamic(
() => import("./Eruda").then((c) => c.ErudaProvider),
{
ssr: false,
}
);

export default function ErudaWrapper({ children }: { children: React.ReactNode }) {
return <ErudaProvider>{children}</ErudaProvider>;
}
2 changes: 1 addition & 1 deletion components/Poll/PollResultsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type VoteState = {
count: number;
};

export default function PollVoteCard({ pollId }: { pollId: number }) {
export default function PollResultsCard({ pollId }: { pollId: number }) {
const router = useRouter();
const { worldID } = useAuth();
const { handleShareResults, isOpen, setIsOpen, shareUrl } = useShare();
Expand Down
5 changes: 4 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
// Enable the React 19 compiler for optimizations
reactStrictMode: true,
};

export default nextConfig;
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "app-router-template",
"name": "worldview-fe",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -14,22 +14,22 @@
"@worldcoin/minikit-js": "1.9.1",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"eruda": "^3.2.3",
"eruda": "^3.4.1",
"jwt-decode": "^4.0.0",
"next": "14.2.26",
"react": "^18",
"react-dom": "^18",
"next": "^15.3.2",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-hook-form": "^7.55.0",
"tailwind-merge": "^3.2.0",
"viem": "^2.26.0",
"zod": "^3.24.2"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/node": "^22.15.18",
"@types/react": "^19.1.4",
"@types/react-dom": "^19.1.5",
"eslint": "^8",
"eslint-config-next": "14.2.6",
"eslint-config-next": "^15.3.2",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
Expand Down
24 changes: 19 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -18,9 +22,19 @@
}
],
"paths": {
"@/*": ["./*"]
}
"@/*": [
"./*"
]
},
"target": "ES2017"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
Loading