ChandimaPrabath's picture
api routes
11c56f5
raw
history blame contribute delete
726 Bytes
import { NextResponse } from 'next/server';
import {BASE_URL} from "@/lib/config";
export async function GET() {
try {
const response = await fetch(`${BASE_URL}/api/get/music/store`);
// Check if the response is ok
if (!response.ok) {
const errorData = await response.json();
return NextResponse.json({ error: errorData.error || 'Failed to fetch music store' }, { status: response.status });
}
const data = await response.json();
return NextResponse.json(data);
} catch (error) {
console.error('Error fetching music store:', error);
return NextResponse.json({ error: 'Failed to fetch music store' }, { status: 500 });
}
}