31 lines
683 B
TypeScript
31 lines
683 B
TypeScript
|
|
import { client } from "./client";
|
||
|
|
import { components } from "../generated/api";
|
||
|
|
|
||
|
|
type ProfileData = components["schemas"]["ProfileResponse"];
|
||
|
|
|
||
|
|
interface UpdateProfileRequest {
|
||
|
|
contact_email: string | null;
|
||
|
|
telegram: string | null;
|
||
|
|
signal: string | null;
|
||
|
|
nostr_npub: string | null;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Profile API endpoints
|
||
|
|
*/
|
||
|
|
export const profileApi = {
|
||
|
|
/**
|
||
|
|
* Get current user's profile
|
||
|
|
*/
|
||
|
|
getProfile(): Promise<ProfileData> {
|
||
|
|
return client.get<ProfileData>("/api/profile");
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Update current user's profile
|
||
|
|
*/
|
||
|
|
updateProfile(request: UpdateProfileRequest): Promise<ProfileData> {
|
||
|
|
return client.put<ProfileData>("/api/profile", request);
|
||
|
|
},
|
||
|
|
};
|