Skip to content

Commit

Permalink
Fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
qvd808 committed Jul 16, 2024
1 parent c504fe9 commit da253ce
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 25 deletions.
26 changes: 9 additions & 17 deletions src/app/(ui)/(volunteer)/checkin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@ export default function Checkin() {
const userName = formData.get("Username");

try {
const response = await fetch("/api/checkin", {
await fetch("/api/checkin", {
method: "POST",
body: JSON.stringify({
userName: userName
userName
})
});
if (response.ok) {
const result = await response.json();
console.log(result);
}
} catch (error) {
console.log(error);
// console.log(error);
}
}

Expand Down Expand Up @@ -52,21 +48,17 @@ export default function Checkin() {
</button>
</form>
{mockInfo.map(
(
item: {
firstName: string;
lastName: string;
timeIn: string;
shift: string;
},
idx
) => (
(item: {
firstName: string;
lastName: string;
timeIn: string;
shift: string;
}) => (
<VolunteerCard
firstName={item.firstName}
lastName={item.lastName}
timeIn={item.timeIn}
shift={item.shift}
key={idx}
/>
)
)}
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/checkin/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import { createClient } from "@supabase/supabase-js";
// }
// }

export async function POST(req: Request) {
export default async function POST(req: Request) {
const supabaseUrl = process.env.NEXT_APP_SUPABASE_URL;
const key = process.env.SUPABASE_KEY;

Expand Down
4 changes: 3 additions & 1 deletion src/app/api/export/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ export default async function GET() {

// Return the CSV data
return new NextResponse(csv, {
/* eslint-disable-next-line object-shorthand */
status: 200,
/* eslint-disable-next-line object-shorthand */
headers: headers
});

// return NextResponse.json({ message: "Success"}, { status: 200});
} catch (error) {
console.error("Error:", error);
// console.error("Error:", error);
return NextResponse.json(
{ message: "An unexpected error occurred" },
{ status: 500 }
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/people/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const GET = async () => {
try {
const supabase = createClient(supabaseUrl, key);
const { data, error } = await supabase.from("users").select("name");
console.log(data);
// console.log(data);
if (error) {
return NextResponse.json({ message: error });
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/api/shifts/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const GET = async () => {
try {
const supabase = createClient(supabaseUrl, key);
const { data, error } = await supabase.from("shifts").select("id");
console.log(data);
// console.log(data);
if (error) {
return NextResponse.json({ message: error });
}
Expand All @@ -27,16 +27,16 @@ export const POST = async (request: NextRequest) => {
const key = process.env.SUPABASE_KEY as string;

try {
const req_body = await request.json();
const reqBody = await request.json();

if (!req_body) {
if (!reqBody) {
return NextResponse.json({
message: "Please provided a req_body"
message: "Please provided a reqBody"
});
}

const supabase = createClient(supabaseUrl, key);
const { data, error } = await supabase.from("shifts").upsert(req_body);
const { data, error } = await supabase.from("shifts").upsert(reqBody);

if (error || !data) {
return NextResponse.json({ message: error });
Expand Down

0 comments on commit da253ce

Please sign in to comment.