fix codacy suggestions
This commit is contained in:
2 files changed
+7
-7
No files matched your search
+2
-2
@@ -21,7 +21,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
},
|
||||
});
|
||||
|
||||
const createMembership = await prisma.membership.create({
|
||||
await prisma.membership.create({
|
||||
data: {
|
||||
teamId: createTeam.id,
|
||||
userId: session.user.id,
|
||||
@@ -33,5 +33,5 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
return res.status(201).json({ message: 'Team created' });
|
||||
}
|
||||
|
||||
res.status(404).json({ message: "Team not found" });
|
||||
res.status(404).json({ message: 'Team not found' });
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import Head from 'next/head';
|
||||
import Shell from '../../components/Shell';
|
||||
import SettingsShell from '../../components/Settings';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useSession } from "next-auth/client";
|
||||
import { useSession } from 'next-auth/client';
|
||||
import {
|
||||
UsersIcon,
|
||||
} from "@heroicons/react/outline";
|
||||
@@ -26,11 +26,11 @@ export default function Teams() {
|
||||
const loadData = () => {
|
||||
fetch("/api/user/membership")
|
||||
.then(handleErrors)
|
||||
.then((data) => {
|
||||
.then((data) => {
|
||||
setTeams(data.membership.filter((m) => m.role !== "INVITEE"));
|
||||
setInvites(data.membership.filter((m) => m.role === "INVITEE"));
|
||||
})
|
||||
.catch(console.log);
|
||||
})
|
||||
.catch(console.log);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -104,7 +104,7 @@ export default function Teams() {
|
||||
{!!invites.length && <div>
|
||||
<h2 className="text-lg leading-6 font-medium text-gray-900">Open Invitations</h2>
|
||||
<ul className="border px-2 rounded mt-2 mb-2 divide-y divide-gray-200">
|
||||
{invites.map((team) => (
|
||||
{invites.map((team) => <TeamListItem onChange={loadData} key={team.id} team={team}></TeamListItem>)}
|
||||
</ul>
|
||||
</div>}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user