linter fixes

This commit is contained in:
Sewmina 2025-06-25 01:26:54 +05:30
parent 7af4d5edc0
commit a7b6600e07
9 changed files with 37 additions and 25 deletions

View File

@ -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 {

View File

@ -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;
}

View File

@ -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&apos;t have an account? </span>
<Link
href="/auth/signup"
className="text-purple-600 hover:text-purple-500 transition-colors"

View File

@ -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&apos;ll send you a link to reset your password.
</p>
</div>

View File

@ -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);
}

View File

@ -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';

View File

@ -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
View 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;
}

View File

@ -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";