refactor(services): remove commented-out code and improve code clarity in iframe-controller, storage, and wallet services
This commit is contained in:
parent
96ee5b03e6
commit
09b1c29788
@ -66,7 +66,6 @@ export class WalletService {
|
|||||||
throw new Error(`[WalletService] Échec: ${e}`);
|
throw new Error(`[WalletService] Échec: ${e}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// -------------------------
|
|
||||||
|
|
||||||
public async saveDeviceInDatabase(device: Device): Promise<void> {
|
public async saveDeviceInDatabase(device: Device): Promise<void> {
|
||||||
await this.db.saveDevice(device);
|
await this.db.saveDevice(device);
|
||||||
|
|||||||
@ -516,7 +516,6 @@ export class IframeController {
|
|||||||
|
|
||||||
// Nous appelons handleApiReturn ici, comme avant.
|
// Nous appelons handleApiReturn ici, comme avant.
|
||||||
await services.handleApiReturn(res);
|
await services.handleApiReturn(res);
|
||||||
// --- FIN DE LA MODIFICATION ---
|
|
||||||
|
|
||||||
window.parent.postMessage(
|
window.parent.postMessage(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import axios, { AxiosResponse } from 'axios';
|
|||||||
export async function storeData(servers: string[], key: string, value: Blob, ttl: number | null): Promise<AxiosResponse | null> {
|
export async function storeData(servers: string[], key: string, value: Blob, ttl: number | null): Promise<AxiosResponse | null> {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
try {
|
try {
|
||||||
// --- DÉBUT DE LA CORRECTION ---
|
|
||||||
// 1. On vérifie d'abord si la donnée existe en appelant le bon service
|
// 1. On vérifie d'abord si la donnée existe en appelant le bon service
|
||||||
// On passe 'server' au lieu de 'url' pour que testData construise la bonne URL
|
// On passe 'server' au lieu de 'url' pour que testData construise la bonne URL
|
||||||
const dataExists = await testData(server, key);
|
const dataExists = await testData(server, key);
|
||||||
@ -14,7 +13,6 @@ export async function storeData(servers: string[], key: string, value: Blob, ttl
|
|||||||
} else {
|
} else {
|
||||||
console.log('Data not stored for server, proceeding to POST:', key, server);
|
console.log('Data not stored for server, proceeding to POST:', key, server);
|
||||||
}
|
}
|
||||||
// --- FIN DE LA CORRECTION ---
|
|
||||||
|
|
||||||
|
|
||||||
// Construction de l'URL pour le POST (stockage)
|
// Construction de l'URL pour le POST (stockage)
|
||||||
@ -112,7 +110,6 @@ interface TestResponse {
|
|||||||
value: boolean;
|
value: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- FONCTION testData CORRIGÉE ---
|
|
||||||
// Elle prend 'server' au lieu de 'url' et construit sa propre URL '/test/...'
|
// Elle prend 'server' au lieu de 'url' et construit sa propre URL '/test/...'
|
||||||
export async function testData(server: string, key: string): Promise<boolean> {
|
export async function testData(server: string, key: string): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user