More warnings cleanup

This commit is contained in:
Selim Mustafaev 2024-05-06 02:01:42 +03:00
parent 0669b8910c
commit 59441b386a
5 changed files with 16 additions and 46 deletions

View File

@ -2,15 +2,15 @@
{
public class Osago
{
public double Date { get; set; }
public string Number { get; set; }
public string Vin { get; set; }
public string PlateNumber { get; set; }
public string Name { get; set; }
public string Status { get; set; }
public string Restrictions { get; set; }
public string Insurant { get; set; }
public string Owner { get; set; }
public string UsageRegion { get; set; }
public double? Date { get; set; }
public string? Number { get; set; }
public string? Vin { get; set; }
public string? PlateNumber { get; set; }
public string? Name { get; set; }
public string? Status { get; set; }
public string? Restrictions { get; set; }
public string? Insurant { get; set; }
public string? Owner { get; set; }
public string? UsageRegion { get; set; }
}
}

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace AutoCatCore.Model;
//[CreateFromString(MethodName = "AutoCat.Controls.PlateNumber.ConvertFromString")]
public class PlateNumber
{
private readonly string _number;

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AutoCat.Model.Requests
{
class Credentials
{
public string Email { get; set; }
public string Password { get; set; }
}
}

View File

@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoCatCore.Model.Requests;
namespace AutoCatCore.Model.Requests
public class PagedResponse<T>(int count, string pageToken, List<T> items)
{
public class PagedResponse<T>
{
public int? Count { get; set; }
public string PageToken { get; set; }
public List<T> Items { get; set; }
}
public int Count { get; set; } = count;
public string PageToken { get; set; } = pageToken;
public List<T> Items { get; set; } = items;
}

View File

@ -1,7 +1,6 @@
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
using AutoCat.Model.Requests;
using AutoCatCore.Model;
using AutoCatCore.Model.Requests;
using AutoCatCore.Services.Storage;
@ -47,12 +46,7 @@ public class ApiService : IApiService
public async Task<User> Login(string email, string password)
{
var credentials = new Credentials { Email = email, Password = password };
var json = JsonSerializer.Serialize(credentials, new JsonSerializerOptions {
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
});
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync("user/login", content);
var response = await _httpClient.PostAsJsonAsync("user/login", new { email, password });
var result = await GetDataOrThrow<User>(response);
SetAccessToken(result.Token);
return result;