Skip to content

Commit

Permalink
Feature/endpoint (#16)
Browse files Browse the repository at this point in the history
**chore:** Add and configure toast, Jest setup, quick search, global types, support page, Babel, and Supabase client mock  
- Set up new configurations for toast notifications, Jest, quick search, global types, support page content, Babel, and Supabase mock.

**feat:** Implement toast, Jest, quick search, global types, support page, Babel, and Supabase client mock  
- Add corresponding feature files and setup.

**refactor:** Clean up components and update imports  
- Removed unnecessary closing tag in the footer component.  
- Updated `dataProvider` import paths in page components.  
- Refactor dropdown component and fix build errors.

**test:** Fix tests and add new cases  
- Fixed broken tests, added new tests for rendering dropdown items, and updated snapshots.

**fix:** Build, pages, and configuration updates  
- Fixed build issues, resolved page rendering errors, updated configuration, and adjusted endpoints.

**chore:** Update dependencies and add Cucumber test script  
- Updated npm dependencies and added `test:cucumber` script for running Cucumber tests.  
- Refactored Supabase client imports and authentication routes.
  • Loading branch information
khaosans authored Oct 3, 2024
1 parent c92581c commit eefed35
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
14 changes: 14 additions & 0 deletions app/api/auth/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { NextResponse } from 'next/server';
import { supabase } from '@/utils/supabase/client';

export async function POST(request: Request) {
const { email, password } = await request.json();

const { data, error } = await supabase.auth.signInWithPassword({ email, password });

if (error) {
return NextResponse.json({ error: error.message }, { status: 401 });
}

return NextResponse.json({ data });
}
2 changes: 1 addition & 1 deletion components/forgot-password-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Label } from "@/components/forms/label";
import { Input } from "@/components/forms/input";
import { FormMessage } from "@/components/forms/form-message";
import { toast } from "react-hot-toast";
import supabase from "@/utils/supabase/client";
import { supabase } from "@/utils/supabase/client";
import { useForm, SubmitHandler } from "react-hook-form";

interface ForgotPasswordForm {
Expand Down
3 changes: 1 addition & 2 deletions utils/supabase/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL!;
const SUPABASE_ANON_KEY = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!;

// Create a single instance of the Supabase client
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
export const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);

export default supabase; // Export the client for use in other files
12 changes: 11 additions & 1 deletion utils/supabaseClient.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@

import { createClient } from '@supabase/supabase-js';
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY

if (!supabaseUrl || !supabaseAnonKey) {
throw new Error('Missing Supabase environment variables')
}

const supabase = createClient(supabaseUrl, supabaseAnonKey);

export default supabase; // Ensure this line is present

0 comments on commit eefed35

Please sign in to comment.