31 lines
894 B
TypeScript
31 lines
894 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
import { requireAuth } from '@/lib/auth'
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const user = await requireAuth()
|
|
|
|
// In a real implementation, you might want to:
|
|
// 1. Store the current playback state in Redis or database
|
|
// 2. Update the currently playing song's play duration
|
|
// 3. Handle pause for streaming services
|
|
|
|
// For now, just return success
|
|
return NextResponse.json(
|
|
{ message: 'Playback paused' },
|
|
{ status: 200 }
|
|
)
|
|
} catch (error) {
|
|
console.error('Pause error:', error)
|
|
if (error instanceof Error && error.message === 'Unauthorized') {
|
|
return NextResponse.json(
|
|
{ error: 'Unauthorized' },
|
|
{ status: 401 }
|
|
)
|
|
}
|
|
return NextResponse.json(
|
|
{ error: 'Failed to pause playback' },
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
} |