chore: update
This commit is contained in:
@@ -1858,6 +1858,7 @@ export interface PublicSettings {
|
||||
points_enabled: boolean;
|
||||
points_separated: boolean;
|
||||
referral_enabled: boolean;
|
||||
referral_amount: number;
|
||||
pool_names: string[];
|
||||
crypto_payment_enabled: boolean;
|
||||
crypto_only: boolean;
|
||||
@@ -1871,6 +1872,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
points_enabled: true,
|
||||
points_separated: true,
|
||||
referral_enabled: true,
|
||||
referral_amount: 0,
|
||||
pool_names: ["Pool 1", "Pool 2"],
|
||||
crypto_payment_enabled: false,
|
||||
crypto_only: false,
|
||||
@@ -1886,6 +1888,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
points_enabled: data.points_enabled ?? true,
|
||||
points_separated: data.points_separated ?? true,
|
||||
referral_enabled: data.referral_enabled ?? true,
|
||||
referral_amount: data.referral_amount ?? 0,
|
||||
pool_names:
|
||||
Array.isArray(data.pool_names) && data.pool_names.length > 0
|
||||
? data.pool_names
|
||||
@@ -1903,6 +1906,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
|
||||
export interface CryptoPaymentStatus {
|
||||
command_id: number;
|
||||
client_order_number?: number;
|
||||
payment_status: string;
|
||||
pay_address: string;
|
||||
pay_amount: number;
|
||||
@@ -2001,3 +2005,48 @@ export const updateMyProfile = async (fields: {
|
||||
return { success: false, message: "Erreur de connexion" };
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// 🤖 TELEGRAM
|
||||
// ============================================
|
||||
|
||||
export const getTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
|
||||
const token = getAuthToken();
|
||||
if (!token) return { linked: false, enabled: false };
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/telegram/status`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
return await safeJson(response);
|
||||
} catch {
|
||||
return { linked: false, enabled: false };
|
||||
}
|
||||
};
|
||||
|
||||
export const generateTelegramLinkToken = async (): Promise<{
|
||||
link_url?: string;
|
||||
error?: string;
|
||||
}> => {
|
||||
const token = getAuthToken();
|
||||
if (!token) return { error: "Non authentifié" };
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/telegram/link-token`, {
|
||||
method: "POST",
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
return await safeJson(response);
|
||||
} catch {
|
||||
return { error: "Erreur de connexion" };
|
||||
}
|
||||
};
|
||||
|
||||
export const unlinkTelegram = async (): Promise<void> => {
|
||||
const token = getAuthToken();
|
||||
if (!token) return;
|
||||
try {
|
||||
await fetch(`${API_URL}/telegram/unlink`, {
|
||||
method: "DELETE",
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
} catch { /* silencieux */ }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user