Skip to Content
Developer HubToolkitUsercreateUserFavorite

createUserFavorite

Pins a country or league (or both) as a favorite for the authenticated user.

This call requires a Bearer JWT obtained from verifySiwe. The server derives userId and affiliateId from the token — they must not be included in the request body.

Usage

import { createUserFavorite } from '@azuro-org/toolkit' const result = await createUserFavorite({ chainId: 100, token: 'eyJ...', // JWT from verifySiwe country: 'England', league: 'Premier League', sportId: 1, }) console.log(result.favoritesId) // server-assigned ID for later deletion

Props

type CreateUserFavoriteParams = { chainId: ChainId token: string // JWT from verifySiwe / useAuth country: string // free-form country identifier (max 255 chars) league: string // free-form league identifier; pass '' to favorite a country only sportId: number // sport identifier (0..32767) }
type ChainId = | 137 // Polygon | 80002 // Polygon Amoy | 8453 // Base | 84532 // Base Sepolia

Return Value

type CreateUserFavoriteResult = { favoritesId: string // server-assigned unique ID; use this for deleteUserFavorite userId: Address // resolved from JWT affiliateId: Address // resolved from JWT country: string league: string sportId: number createdAt: string // ISO 8601 timestamp }
Last updated on