style: format code
This commit is contained in:
parent
637f33d0ff
commit
3e877ea1d2
7 changed files with 33 additions and 13 deletions
|
@ -1,10 +1,10 @@
|
||||||
import { getApiDocs } from "@/lib/swagger";
|
import { getApiDocs } from '@/lib/swagger';
|
||||||
import ReactSwagger from "./react-swagger";
|
import ReactSwagger from './react-swagger';
|
||||||
|
|
||||||
export default async function IndexPage() {
|
export default async function IndexPage() {
|
||||||
const spec = await getApiDocs();
|
const spec = await getApiDocs();
|
||||||
return (
|
return (
|
||||||
<section className="container">
|
<section className='container'>
|
||||||
<ReactSwagger spec={spec} />
|
<ReactSwagger spec={spec} />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import SwaggerUI from 'swagger-ui-react';
|
||||||
import 'swagger-ui-react/swagger-ui.css';
|
import 'swagger-ui-react/swagger-ui.css';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
spec: object,
|
spec: object;
|
||||||
};
|
};
|
||||||
|
|
||||||
function ReactSwagger({ spec }: Props) {
|
function ReactSwagger({ spec }: Props) {
|
||||||
|
|
|
@ -357,7 +357,14 @@ export const PATCH = auth(async (req, { params }) => {
|
||||||
|
|
||||||
const { title, description, start_time, end_time, location, status } = body;
|
const { title, description, start_time, end_time, location, status } = body;
|
||||||
|
|
||||||
if (!title && !description && !start_time && !end_time && !location && !status) {
|
if (
|
||||||
|
!title &&
|
||||||
|
!description &&
|
||||||
|
!start_time &&
|
||||||
|
!end_time &&
|
||||||
|
!location &&
|
||||||
|
!status
|
||||||
|
) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ success: false, message: 'No fields to update' },
|
{ success: false, message: 'No fields to update' },
|
||||||
{ status: 400 },
|
{ status: 400 },
|
||||||
|
@ -406,5 +413,8 @@ export const PATCH = auth(async (req, { params }) => {
|
||||||
data: updateData,
|
data: updateData,
|
||||||
});
|
});
|
||||||
|
|
||||||
return NextResponse.json({ success: true, event: updatedEvent }, { status: 200 });
|
return NextResponse.json(
|
||||||
|
{ success: true, event: updatedEvent },
|
||||||
|
{ status: 200 },
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"use client";
|
'use client';
|
||||||
|
|
||||||
import { RedirectButton } from '@/components/buttons/redirect-button';
|
import { RedirectButton } from '@/components/buttons/redirect-button';
|
||||||
import { ThemePicker } from '@/components/misc/theme-picker';
|
import { ThemePicker } from '@/components/misc/theme-picker';
|
||||||
|
@ -11,7 +11,10 @@ export default function Home() {
|
||||||
<div className='flex flex-col items-center justify-center h-screen'>
|
<div className='flex flex-col items-center justify-center h-screen'>
|
||||||
<div className='absolute top-4 right-4'>{<ThemePicker />}</div>
|
<div className='absolute top-4 right-4'>{<ThemePicker />}</div>
|
||||||
<div>
|
<div>
|
||||||
<h1>Hello {isLoading ? 'Loading...' : data?.data.user?.name || 'Unknown User'}</h1>
|
<h1>
|
||||||
|
Hello{' '}
|
||||||
|
{isLoading ? 'Loading...' : data?.data.user?.name || 'Unknown User'}
|
||||||
|
</h1>
|
||||||
<RedirectButton redirectUrl='/logout' buttonText='Logout' />
|
<RedirectButton redirectUrl='/logout' buttonText='Logout' />
|
||||||
<RedirectButton redirectUrl='/settings' buttonText='Settings' />
|
<RedirectButton redirectUrl='/settings' buttonText='Settings' />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,7 +25,11 @@ const providers: Provider[] = [
|
||||||
Credentials({
|
Credentials({
|
||||||
credentials: { password: { label: 'Password', type: 'password' } },
|
credentials: { password: { label: 'Password', type: 'password' } },
|
||||||
async authorize(c) {
|
async authorize(c) {
|
||||||
if (process.env.NODE_ENV === 'development' && process.env.DISABLE_AUTH_TEST_USER !== 'true' && c.password === 'password')
|
if (
|
||||||
|
process.env.NODE_ENV === 'development' &&
|
||||||
|
process.env.DISABLE_AUTH_TEST_USER !== 'true' &&
|
||||||
|
c.password === 'password'
|
||||||
|
)
|
||||||
return {
|
return {
|
||||||
id: 'test',
|
id: 'test',
|
||||||
name: 'Test User',
|
name: 'Test User',
|
||||||
|
|
|
@ -35,7 +35,10 @@ export async function registerAction(data: z.infer<typeof registerSchema>) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (existingUsername || disallowedUsernames.includes(username.toLowerCase())) {
|
if (
|
||||||
|
existingUsername ||
|
||||||
|
disallowedUsernames.includes(username.toLowerCase())
|
||||||
|
) {
|
||||||
return {
|
return {
|
||||||
error: 'Username already exists',
|
error: 'Username already exists',
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue