mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 23:28:11 +00:00
33 lines
952 B
TypeScript
33 lines
952 B
TypeScript
import { api as client } from "../auth/http";
|
|
import { unwrap } from "@/utils/endpoint";
|
|
|
|
const SIGNATURE_URL = "/me/signature";
|
|
|
|
export interface SavedSignature {
|
|
signerDisplayName: string;
|
|
signatureImageUrl?: string | null;
|
|
}
|
|
|
|
export interface SaveSignaturePayload {
|
|
signerDisplayName: string;
|
|
signatureImageBase64: string;
|
|
}
|
|
|
|
export const signaturesService = {
|
|
/** Returns the current user's reusable signature, or null if none saved. */
|
|
getMySignature: async (): Promise<SavedSignature | null> => {
|
|
const response = await client.get<SavedSignature | null>(SIGNATURE_URL);
|
|
return (unwrap(response.data) as SavedSignature | null) ?? null;
|
|
},
|
|
|
|
saveMySignature: async (
|
|
payload: SaveSignaturePayload,
|
|
): Promise<SavedSignature | null> => {
|
|
const response = await client.put<SavedSignature | null>(
|
|
SIGNATURE_URL,
|
|
payload,
|
|
);
|
|
return (unwrap(response.data) as SavedSignature | null) ?? null;
|
|
},
|
|
};
|