< Summary

Information
Class: Syki.Front.Features.Cross.Login.LoginClient
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Features/Cross/Login/LoginClient.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 24
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Login()100%22100%

File(s)

/home/runner/work/syki/syki/Front/Features/Cross/Login/LoginClient.cs

#LineLine coverage
 1using Newtonsoft.Json;
 2using Microsoft.JSInterop;
 3
 4namespace Syki.Front.Features.Cross.Login;
 5
 3876public class LoginClient(HttpClient http, ILocalStorageService localStorage, SykiAuthStateProvider authStateProvider) : 
 7{
 8    public async Task<LoginOut> Login(string email, string password)
 9    {
 38710        var body = new LoginIn(email, password);
 38711        var response = await http.PostAsJsonAsync("/login", body);
 12
 38713        var responseAsString = await response.Content.ReadAsStringAsync();
 38714        var result = JsonConvert.DeserializeObject<LoginOut>(responseAsString)!;
 15
 38716        if (result.AccessToken != null)
 17        {
 38018            await localStorage.SetItemAsync("AccessToken", result.AccessToken);
 38019            authStateProvider.MarkUserAsAuthenticated();
 20        }
 21
 38722        return result;
 38723    }
 24}