import React, { useState } from 'react'; import { Card } from '../ui/card'; import { Button } from '../ui/button'; import { Play, RotateCcw, Copy } from 'lucide-react'; import { useToast } from '../../context/ToastContext'; const ENDPOINTS = [ { method: 'GET', path: '/v1/user/profile', desc: 'Get current user profile' }, { method: 'GET', path: '/v1/tracks', desc: 'List tracks' }, { method: 'POST', path: '/v1/tracks/upload', desc: 'Upload a new track' }, { method: 'GET', path: '/v1/sales/history', desc: 'Get sales history' }, ]; export const APIPlaygroundView: React.FC = () => { const { addToast } = useToast(); const [selectedEndpoint, setSelectedEndpoint] = useState(ENDPOINTS[0]); const [params, setParams] = useState('{\n "limit": 10,\n "offset": 0\n}'); const [response, setResponse] = useState(null); const [loading, setLoading] = useState(false); const handleSend = () => { setLoading(true); setResponse(null); // Simulate network request setTimeout(() => { setLoading(false); setResponse(JSON.stringify({ status: 200, data: { message: "Success", timestamp: new Date().toISOString(), result: [ { id: 1, name: "Sample Item" }, { id: 2, name: "Another Item" } ] } }, null, 2)); addToast("Request successful", "success"); }, 800); }; return (

API PLAYGROUND

{/* Request Builder */}

Request

{selectedEndpoint.desc}