chore: add notification telegram

This commit is contained in:
2026-03-24 11:51:22 +01:00
parent a8eeb55e72
commit 79c050d689
15 changed files with 424 additions and 253 deletions
+24 -5
View File
@@ -813,17 +813,36 @@ export const getCryptoPaymentStatus = async (commandId: number): Promise<CryptoP
}
};
export const registerPushToken = async (token: string): Promise<void> => {
// ============================================
// TELEGRAM
// ============================================
export const getTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
try {
await apiClient.post(`${V1}/push-token`, { push_token: token });
const { data } = await apiClient.get(`${V1}/telegram/status`);
return data;
} catch {
// silencieux
return { linked: false, enabled: false };
}
};
export const unregisterPushToken = async (): Promise<void> => {
export const generateTelegramLinkToken = async (): Promise<{
token?: string;
link_url?: string;
expires_in?: number;
error?: string;
}> => {
try {
await apiClient.delete(`${V1}/push-token`);
const { data } = await apiClient.post(`${V1}/telegram/link-token`);
return data;
} catch (e: any) {
return { error: e?.response?.data?.error || "Erreur" };
}
};
export const unlinkTelegram = async (): Promise<void> => {
try {
await apiClient.delete(`${V1}/telegram/unlink`);
} catch {
// silencieux
}