linter fixes
This commit is contained in:
parent
7af4d5edc0
commit
a7b6600e07
|
|
@ -1,5 +1,5 @@
|
|||
import { NextResponse } from 'next/server';
|
||||
import { getReceiptId } from '../webhooks/stripe/route';
|
||||
import { getReceiptId } from '../../lib/receipts';
|
||||
|
||||
export async function GET(req: Request) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { NextResponse } from 'next/server';
|
||||
import { headers } from 'next/headers';
|
||||
|
||||
// In-memory storage for demo purposes - in production, use a database
|
||||
const paymentReceipts = new Map<string, string>();
|
||||
import { storeReceiptId } from '../../../lib/receipts';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
try {
|
||||
|
|
@ -36,7 +34,7 @@ export async function POST(req: Request) {
|
|||
|
||||
// Store the payment intent ID as the receipt ID
|
||||
if (paymentIntentId) {
|
||||
paymentReceipts.set(sessionId, paymentIntentId);
|
||||
storeReceiptId(sessionId, paymentIntentId);
|
||||
console.log(`Stored receipt ID ${paymentIntentId} for session ${sessionId}`);
|
||||
}
|
||||
}
|
||||
|
|
@ -49,9 +47,4 @@ export async function POST(req: Request) {
|
|||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to get receipt ID for a session
|
||||
export function getReceiptId(sessionId: string): string | null {
|
||||
return paymentReceipts.get(sessionId) || null;
|
||||
}
|
||||
|
|
@ -20,8 +20,9 @@ export default function LoginPage() {
|
|||
setLoading(true);
|
||||
await signIn(email, password);
|
||||
router.push('/'); // Redirect to home page after successful login
|
||||
} catch (error: any) {
|
||||
setError(error.message || 'Failed to sign in');
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : 'Failed to sign in';
|
||||
setError(errorMessage);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
@ -33,8 +34,9 @@ export default function LoginPage() {
|
|||
setLoading(true);
|
||||
await signInWithGoogle();
|
||||
router.push('/');
|
||||
} catch (error: any) {
|
||||
setError(error.message || 'Failed to sign in with Google');
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : 'Failed to sign in with Google';
|
||||
setError(errorMessage);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
@ -153,7 +155,7 @@ export default function LoginPage() {
|
|||
</form>
|
||||
|
||||
<div className="text-center text-sm">
|
||||
<span className="text-foreground/60">Don't have an account? </span>
|
||||
<span className="text-foreground/60">Don't have an account? </span>
|
||||
<Link
|
||||
href="/auth/signup"
|
||||
className="text-purple-600 hover:text-purple-500 transition-colors"
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@ export default function ResetPasswordPage() {
|
|||
setLoading(true);
|
||||
await resetPassword(email);
|
||||
setMessage('Check your email for password reset instructions');
|
||||
} catch (error: any) {
|
||||
setError(error.message || 'Failed to reset password');
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : 'Failed to reset password';
|
||||
setError(errorMessage);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
@ -34,7 +35,7 @@ export default function ResetPasswordPage() {
|
|||
Reset your password
|
||||
</h2>
|
||||
<p className="mt-2 text-center text-sm text-foreground/60">
|
||||
Enter your email address and we'll send you a link to reset your password.
|
||||
Enter your email address and we'll send you a link to reset your password.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@ export default function SignUpPage() {
|
|||
setLoading(true);
|
||||
await signUp(email, password);
|
||||
router.push('/'); // Redirect to home page after successful signup
|
||||
} catch (error: any) {
|
||||
setError(error.message || 'Failed to create an account');
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : 'Failed to create an account';
|
||||
setError(errorMessage);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
@ -39,8 +40,9 @@ export default function SignUpPage() {
|
|||
setLoading(true);
|
||||
await signInWithGoogle();
|
||||
router.push('/');
|
||||
} catch (error: any) {
|
||||
setError(error.message || 'Failed to sign up with Google');
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : 'Failed to sign up with Google';
|
||||
setError(errorMessage);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { getStripe } from '../lib/stripe';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import Image from 'next/image';
|
||||
import { cleanImageUrl, getRarityColor, getRarityLabel, type Reward } from '../lib/rewards';
|
||||
|
||||
interface RewardCardProps {
|
||||
|
|
@ -13,9 +14,11 @@ export default function RewardCard({ reward, showValue = true, className = '' }:
|
|||
<div className={`bg-background/50 rounded-xl p-6 ${className}`}>
|
||||
{reward.image && (
|
||||
<div className="mb-4">
|
||||
<img
|
||||
<Image
|
||||
src={cleanImageUrl(reward.image)}
|
||||
alt={reward.name}
|
||||
width={96}
|
||||
height={96}
|
||||
className="w-24 h-24 object-contain mx-auto rounded-lg"
|
||||
onError={(e) => {
|
||||
// Fallback to emoji if image fails to load
|
||||
|
|
|
|||
12
app/lib/receipts.ts
Normal file
12
app/lib/receipts.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// In-memory storage for demo purposes - in production, use a database
|
||||
const paymentReceipts = new Map<string, string>();
|
||||
|
||||
// Store receipt ID for a session
|
||||
export function storeReceiptId(sessionId: string, receiptId: string): void {
|
||||
paymentReceipts.set(sessionId, receiptId);
|
||||
}
|
||||
|
||||
// Helper function to get receipt ID for a session
|
||||
export function getReceiptId(sessionId: string): string | null {
|
||||
return paymentReceipts.get(sessionId) || null;
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import Header from "./components/Header";
|
||||
import { useAuth } from "./context/AuthContext";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user