Spotify User Profile Service

This module provides functionality for retrieving and managing user profile information from the Spotify API. It handles fetching profile details such as display name, profile image, country, and subscription level.

Features:

  • User profile information retrieval
  • Automatic token validation before API calls
  • Comprehensive error handling
  • Automatic retry for failed API requests

The user profile information is essential for personalizing the application experience and displaying user-specific content throughout the interface.

Usage:

import { getCurrentUser } from '@/services/spotify/user';

// Fetch the current user's profile information
try {
const profile = await getCurrentUser();
console.log(`Hello, ${profile.display_name}!`);
} catch (error) {
console.error('Failed to fetch user profile:', error);
}

Functions

getCurrentUser