mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
singlequotes
This commit is contained in:
parent
e6654a5e5b
commit
ab42334f2c
@ -1,10 +1,10 @@
|
|||||||
"use client";
|
'use client';
|
||||||
|
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from 'react';
|
||||||
import { signIn, signOut, getCsrfToken } from "next-auth/react";
|
import { signIn, signOut, getCsrfToken } from 'next-auth/react';
|
||||||
import sdk, { SignIn as SignInCore } from "@farcaster/frame-sdk";
|
import sdk, { SignIn as SignInCore } from '@farcaster/frame-sdk';
|
||||||
import { useSession } from "next-auth/react";
|
import { useSession } from 'next-auth/react';
|
||||||
import { Button } from "../Button";
|
import { Button } from '../Button';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SignIn component handles Farcaster authentication using Sign-In with Farcaster (SIWF).
|
* SignIn component handles Farcaster authentication using Sign-In with Farcaster (SIWF).
|
||||||
@ -55,7 +55,7 @@ export function SignIn() {
|
|||||||
*/
|
*/
|
||||||
const getNonce = useCallback(async () => {
|
const getNonce = useCallback(async () => {
|
||||||
const nonce = await getCsrfToken();
|
const nonce = await getCsrfToken();
|
||||||
if (!nonce) throw new Error("Unable to generate nonce");
|
if (!nonce) throw new Error('Unable to generate nonce');
|
||||||
return nonce;
|
return nonce;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -77,17 +77,17 @@ export function SignIn() {
|
|||||||
const nonce = await getNonce();
|
const nonce = await getNonce();
|
||||||
const result = await sdk.actions.signIn({ nonce });
|
const result = await sdk.actions.signIn({ nonce });
|
||||||
setSignInResult(result);
|
setSignInResult(result);
|
||||||
await signIn("credentials", {
|
await signIn('credentials', {
|
||||||
message: result.message,
|
message: result.message,
|
||||||
signature: result.signature,
|
signature: result.signature,
|
||||||
redirect: false,
|
redirect: false,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof SignInCore.RejectedByUser) {
|
if (e instanceof SignInCore.RejectedByUser) {
|
||||||
setSignInFailure("Rejected by user");
|
setSignInFailure('Rejected by user');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSignInFailure("Unknown error");
|
setSignInFailure('Unknown error');
|
||||||
} finally {
|
} finally {
|
||||||
setAuthState((prev) => ({ ...prev, signingIn: false }));
|
setAuthState((prev) => ({ ...prev, signingIn: false }));
|
||||||
}
|
}
|
||||||
@ -115,12 +115,12 @@ export function SignIn() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Authentication Buttons */}
|
{/* Authentication Buttons */}
|
||||||
{status !== "authenticated" && (
|
{status !== 'authenticated' && (
|
||||||
<Button onClick={handleSignIn} disabled={authState.signingIn}>
|
<Button onClick={handleSignIn} disabled={authState.signingIn}>
|
||||||
Sign In with Farcaster
|
Sign In with Farcaster
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{status === "authenticated" && (
|
{status === 'authenticated' && (
|
||||||
<Button onClick={handleSignOut} disabled={authState.signingOut}>
|
<Button onClick={handleSignOut} disabled={authState.signingOut}>
|
||||||
Sign out
|
Sign out
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user