mirror of
https://github.com/mito-systems/ranger-app.git
synced 2026-05-05 09:24:07 +00:00
go
This commit is contained in:
parent
17fb74863e
commit
9146a69c99
@ -393,6 +393,13 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
||||
species
|
||||
});
|
||||
|
||||
// Log wallet address for debugging token award
|
||||
console.log('Starting token award with address:', {
|
||||
walletAddressFromForm: walletAddress,
|
||||
species: species,
|
||||
hasAddress: !!walletAddress
|
||||
});
|
||||
|
||||
// Attempt to award tokens for this wildlife sighting
|
||||
const tokenResult = await awardTokensForSighting(species, undefined, walletAddress);
|
||||
|
||||
|
||||
@ -38,6 +38,16 @@ export default function PointsPage() {
|
||||
if (userIdentifier) {
|
||||
console.log('Loading points using email identifier:', userIdentifier);
|
||||
loadUserPoints(userIdentifier);
|
||||
|
||||
// Set up an interval to refresh points periodically
|
||||
const refreshInterval = setInterval(() => {
|
||||
console.log('Automatically refreshing points data...');
|
||||
loadUserPoints(userIdentifier);
|
||||
}, 10000); // Refresh every 10 seconds
|
||||
|
||||
return () => {
|
||||
clearInterval(refreshInterval);
|
||||
};
|
||||
} else {
|
||||
// Fallback to ID if somehow email is missing
|
||||
const userId = session.user.id;
|
||||
|
||||
@ -66,9 +66,27 @@ const WildlifeIdentifier: React.FC = () => {
|
||||
formData.append('image', selectedImage);
|
||||
|
||||
// Add wallet address to the request if connected
|
||||
const userAddress = getWalletAddress();
|
||||
// Get the wallet address both from memory and localStorage as backup
|
||||
let userAddress = getWalletAddress();
|
||||
|
||||
// If no in-memory address, try localStorage as fallback
|
||||
if (!userAddress && typeof window !== 'undefined') {
|
||||
try {
|
||||
const storedAddress = localStorage.getItem('wildlife_wallet_address');
|
||||
if (storedAddress) {
|
||||
console.log('Using wallet address from localStorage:', storedAddress);
|
||||
userAddress = storedAddress;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Error accessing localStorage:', e);
|
||||
}
|
||||
}
|
||||
|
||||
if (userAddress) {
|
||||
console.log('Found wallet address to include in upload:', userAddress);
|
||||
formData.append('walletAddress', userAddress);
|
||||
} else {
|
||||
console.log('No wallet address found for upload');
|
||||
}
|
||||
|
||||
console.log('Uploading image for analysis...');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user