feat: implement user authentication with login functionality
- Add auth-api for handling login requests. - Update index.ts to export AuthApi. - Modify HeroLayout to display username or login link based on authentication state. - Create LoginPage component for user login. - Update router to include login route with EmptyLayout. - Configure WebClient to include credentials in requests. - Add auth-slice for managing authentication state in Redux. - Update Redux store to include auth reducer. - Define LoginRequest and User types in types/index.ts. - Configure Vite to proxy API requests to the backend server.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import { LoginRequest, User } from "@/types"
|
||||
import { WebClient } from "@/shared/web-client"
|
||||
|
||||
export async function login(loginRequest: LoginRequest): Promise<User> {
|
||||
const { data } = await WebClient.post<User>("/auth/login", {
|
||||
...loginRequest,
|
||||
})
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user