fix: LOW issues #37-#50 — remove mock data, type auth functions, ImageElement interface, remove dead code, implement zoom/format/search, cleanup
This commit is contained in:
@@ -30,8 +30,32 @@ export interface Drawing {
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
// ─── Auth Types ────────────────────────────────────────
|
||||
export interface AuthUser {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
role: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface AuthSession {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
user: AuthUser;
|
||||
session: AuthSession;
|
||||
}
|
||||
|
||||
export interface RegisterResponse {
|
||||
user: AuthUser;
|
||||
session: AuthSession;
|
||||
}
|
||||
|
||||
// ─── Auth ───────────────────────────────────────────────
|
||||
export async function login(email: string, password: string): Promise<{ user: any; session: { token: string } }> {
|
||||
export async function login(email: string, password: string): Promise<LoginResponse> {
|
||||
const res = await fetch(`${API_BASE}/api/auth/login`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
@@ -41,7 +65,7 @@ export async function login(email: string, password: string): Promise<{ user: an
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function register(email: string, password: string, name: string): Promise<{ user: any; session: { token: string } }> {
|
||||
export async function register(email: string, password: string, name: string): Promise<RegisterResponse> {
|
||||
const res = await fetch(`${API_BASE}/api/auth/register`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
@@ -51,7 +75,7 @@ export async function register(email: string, password: string, name: string): P
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function getMe(token: string): Promise<any> {
|
||||
export async function getMe(token: string): Promise<AuthUser> {
|
||||
const res = await fetch(`${API_BASE}/api/auth/me`, {
|
||||
headers: authHeaders(token),
|
||||
});
|
||||
|
||||
@@ -175,6 +175,11 @@ export class BackgroundService {
|
||||
this.image = null;
|
||||
}
|
||||
|
||||
/** Dispose of resources — called on component unmount */
|
||||
dispose(): void {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
/** Export to ProjectData.background format */
|
||||
toProjectData(): ProjectData['background'] | undefined {
|
||||
if (!this.isLoaded()) return undefined;
|
||||
|
||||
Reference in New Issue
Block a user