Use new Auth API
This commit is contained in:
parent
38e76d3539
commit
79c17f75cd
16 changed files with 94 additions and 150 deletions
19
Website/Data/AuthenticationProvider.cs
Normal file
19
Website/Data/AuthenticationProvider.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue