Fix auth types export issue
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import type { LoginRequest, LoginResponse, UserInfo } from '../types/auth';
|
||||||
|
|
||||||
const API_BASE_URL = 'http://localhost:5163/api';
|
const API_BASE_URL = 'http://localhost:5163/api';
|
||||||
|
|
||||||
@@ -34,23 +35,10 @@ api.interceptors.response.use(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Re-export types for convenience
|
||||||
|
export type { LoginRequest, LoginResponse, UserInfo };
|
||||||
|
|
||||||
// Auth API
|
// Auth API
|
||||||
export interface LoginRequest {
|
|
||||||
email: string;
|
|
||||||
password: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LoginResponse {
|
|
||||||
token: string;
|
|
||||||
email: string;
|
|
||||||
roles: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UserInfo {
|
|
||||||
email: string;
|
|
||||||
roles: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const authApi = {
|
export const authApi = {
|
||||||
login: async (data: LoginRequest): Promise<LoginResponse> => {
|
login: async (data: LoginRequest): Promise<LoginResponse> => {
|
||||||
const response = await axios.post(`${API_BASE_URL}/auth/login`, data);
|
const response = await axios.post(`${API_BASE_URL}/auth/login`, data);
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
export interface LoginRequest {
|
||||||
|
email: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoginResponse {
|
||||||
|
token: string;
|
||||||
|
email: string;
|
||||||
|
roles: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UserInfo {
|
||||||
|
email: string;
|
||||||
|
roles: string[];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user