From f55800cd729cb55e5d3b890de92142ce2398fa57 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 31 May 2023 23:12:45 -0300 Subject: [PATCH] fix: Implement better domain id check on DNS restoration --- .../server_installation_repository.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index bc92f645..bee112f9 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -190,7 +190,16 @@ class ServerInstallationRepository { ), ); - final String? domainId = await dnsProviderApi.getZoneId(domain); + /// TODO: nvm it's because only Cloudflare uses Zone + /// for other providers we need to implement a different kind of + /// functionality here... but it's on refactoring, let it be here for now. + final APIGenericResult apiResponse = + await dnsProviderApi.isApiTokenValid(token); + + String? domainId; + if (apiResponse.success && apiResponse.data) { + domainId = await dnsProviderApi.getZoneId(domain); + } return domainId; }