Use new Auth API

This commit is contained in:
Robert Marshall 2020-04-12 14:25:16 +01:00
parent 38e76d3539
commit 79c17f75cd
16 changed files with 94 additions and 150 deletions

View file

@ -0,0 +1,19 @@
using System.Net.Http;
using System.Threading.Tasks;
using Website.Models;
namespace Website.Data {
public class AuthenticationProvider:ApiClient, IAuthenticationProvider {
public AuthenticationProvider(HttpClient client) : base(client) {
}
public async Task<User> Authenticate(LoginRequest request) {
try {
return await Post<User>("authenticate", request);
}
catch (ApiCallException) {
return null;
}
}
}
}