fix codacy suggestions
This commit is contained in:
parent
715033f4e1
commit
6463b3ba37
2 changed files with 7 additions and 7 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue