@@ -13,8 +13,7 @@ namespace TodoSQLite.Data;
1313
1414public class NodeConnector : IPowerSyncBackendConnector
1515{
16- private static readonly string StorageFilePath = "user_id.txt" ; // Simulating local storage
17- private readonly HttpClient _httpClient ;
16+ private readonly HttpClient httpClient ;
1817
1918 public string BackendUrl { get ; }
2019 public string PowerSyncUrl { get ; }
@@ -23,7 +22,7 @@ public class NodeConnector : IPowerSyncBackendConnector
2322
2423 public NodeConnector ( )
2524 {
26- _httpClient = new HttpClient ( ) ;
25+ httpClient = new HttpClient ( ) ;
2726
2827 // Load or generate User ID
2928 UserId = LoadOrGenerateUserId ( ) ;
@@ -41,10 +40,10 @@ public string LoadOrGenerateUserId()
4140
4241 public async Task < PowerSyncCredentials ? > FetchCredentials ( )
4342 {
44- string tokenEndpoint = "api/auth/token" ;
45- string url = $ "{ BackendUrl } /{ tokenEndpoint } ?user_id={ UserId } ";
43+ var tokenEndpoint = "api/auth/token" ;
44+ var url = $ "{ BackendUrl } /{ tokenEndpoint } ?user_id={ UserId } ";
4645
47- HttpResponseMessage response = await _httpClient . GetAsync ( url ) ;
46+ var response = await httpClient . GetAsync ( url ) ;
4847 if ( ! response . IsSuccessStatusCode )
4948 {
5049 throw new Exception ( $ "Received { response . StatusCode } from { tokenEndpoint } : { await response . Content . ReadAsStringAsync ( ) } ") ;
@@ -99,7 +98,7 @@ public async Task UploadData(IPowerSyncDatabase database)
9998 var payload = JsonSerializer . Serialize ( new { batch } ) ;
10099 var content = new StringContent ( payload , Encoding . UTF8 , "application/json" ) ;
101100
102- HttpResponseMessage response = await _httpClient . PostAsync ( $ "{ BackendUrl } /api/data", content ) ;
101+ HttpResponseMessage response = await httpClient . PostAsync ( $ "{ BackendUrl } /api/data", content ) ;
103102
104103 if ( ! response . IsSuccessStatusCode )
105104 {
0 commit comments