From b2a7df5760c8281130640985919819f3fd6f2368 Mon Sep 17 00:00:00 2001 From: Vishesh 'ironeagle' Bangotra Date: Tue, 11 Nov 2025 18:47:16 +0530 Subject: [PATCH] username and password instead of email and password --- src/blog/providers/Author.tsx | 8 ++++---- src/blog/types/contexts.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/blog/providers/Author.tsx b/src/blog/providers/Author.tsx index 99e09a2..b212a5a 100644 --- a/src/blog/providers/Author.tsx +++ b/src/blog/providers/Author.tsx @@ -13,12 +13,12 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children const [error, setError] = useState(null); /** 🔹 Register new user */ - const register = async (username: string, email: string, password: string) => { + const register = async (username: string, password: string) => { try { setLoading(true); setError(null); - const res = await api.post('/auth/register', { username, email, password }); + const res = await api.post('/auth/register', { username, password }); return res.data; // returns PublicUser from backend } catch (err: any) { console.error('Registration failed:', err); @@ -29,12 +29,12 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }; /** 🔹 Login and store JWT token */ - const login = async (email: string, password: string) => { + const login = async (username: string, password: string) => { try { setLoading(true); setError(null); - const res = await api.post('/auth/login', { email, password }); + const res = await api.post('/auth/login', { username, password }); const { access_token, user } = res.data; if (access_token) { diff --git a/src/blog/types/contexts.ts b/src/blog/types/contexts.ts index e9f3f7e..2100ccd 100644 --- a/src/blog/types/contexts.ts +++ b/src/blog/types/contexts.ts @@ -13,8 +13,8 @@ export interface AuthContextModel { token: string | null; loading: boolean; error: string | null; - login: (email: string, password: string) => Promise; - register: (username: string, email: string, password: string) => Promise; + login: (username: string, password: string) => Promise; + register: (username: string, password: string) => Promise; logout: () => void; refreshAuthors: () => Promise; }