Unused varibles and methods removal,
Change the way error handling works so I dont have explicit any type.
This commit is contained in:
parent
f192e51f3c
commit
406963f6bf
@ -28,11 +28,12 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
return NextResponse.json({data: data}, {status: response.status});
|
||||
} catch (error: any) {
|
||||
NextResponse.json({message: 'Going to server error', error: error.message})
|
||||
} catch (error) {
|
||||
console.error('Error handling request:', error);
|
||||
NextResponse.json({message: 'Going to server error'}, {status: 500});
|
||||
}
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
console.error('Error handling request:', error);
|
||||
return NextResponse.json({ message: 'Internal Server Error', error: error.message }, { status: 500 });
|
||||
return NextResponse.json({ message: 'Internal Server Error'}, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,13 @@ const ReportButton: React.FC<ReportButtonProps> = ({ bookId, chapterId }) => {
|
||||
// Implement report submission here
|
||||
event.preventDefault()
|
||||
const response = await createReport(errorType,details,bookId,chapterId)
|
||||
response.status === 201 ? alert('Report submitted successfully') : alert('Failed to submit report')
|
||||
//Linting be linting
|
||||
if (response.status === 201){
|
||||
alert('Report submitted successfully')
|
||||
}
|
||||
else{
|
||||
alert('Failed to submit report')
|
||||
}
|
||||
setErrorType('')
|
||||
setDetails('')
|
||||
setIsOpen(false)
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { addDays, subDays } from "date-fns";
|
||||
import { Book, Chapter, Editor, Announcement, Glossary, Report } from "./types";
|
||||
import { Book, Chapter, Editor, Announcement, Glossary } from "./types";
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL as string;
|
||||
const API_TOKEN = process.env.STRAPI_API_TOKEN as string;
|
||||
|
Loading…
Reference in New Issue
Block a user