2024-01-22 17:38:02 +11:00
|
|
|
'use client';
|
|
|
|
|
|
2024-03-13 13:24:09 +05:30
|
|
|
import { useEffect } from 'react';
|
|
|
|
|
|
|
|
|
|
import { useTheme } from 'next-themes';
|
2024-01-19 16:55:16 +02:00
|
|
|
import SwaggerUI from 'swagger-ui-react';
|
|
|
|
|
import 'swagger-ui-react/swagger-ui.css';
|
|
|
|
|
|
|
|
|
|
import { OpenAPIV1 } from '@documenso/api/v1/openapi';
|
|
|
|
|
|
|
|
|
|
export const OpenApiDocsPage = () => {
|
2024-03-13 13:24:09 +05:30
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const body = document.body;
|
|
|
|
|
|
|
|
|
|
if (theme === 'dark') {
|
|
|
|
|
body.classList.add('swagger-dark-theme');
|
|
|
|
|
} else {
|
|
|
|
|
body.classList.remove('swagger-dark-theme');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
body.classList.remove('swagger-dark-theme');
|
|
|
|
|
};
|
|
|
|
|
}, [theme]);
|
|
|
|
|
|
2024-01-19 16:55:16 +02:00
|
|
|
return <SwaggerUI spec={OpenAPIV1} displayOperationId={true} />;
|
|
|
|
|
};
|
2024-03-01 14:54:41 +11:00
|
|
|
|
|
|
|
|
export default OpenApiDocsPage;
|