< Summary

Information
Class: Syki.Front.Features.Cross.LoginMfa.LoginMfaClient
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Features/Cross/LoginMfa/LoginMfaClient.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: 4
Total branches: 4
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%44100%

File(s)

/home/runner/work/syki/syki/Front/Features/Cross/LoginMfa/LoginMfaClient.cs

#LineLine coverage
 1using Newtonsoft.Json;
 2using Microsoft.JSInterop;
 3
 4namespace Syki.Front.Features.Cross.LoginMfa;
 5
 36public class LoginMfaClient(HttpClient http, ILocalStorageService localStorage, SykiAuthStateProvider authStateProvider)
 7{
 8    public async Task<LoginMfaOut> Login(string code)
 9    {
 310        var body = new LoginMfaIn { Token = code };
 311        var response = await http.PostAsJsonAsync("/login/mfa", body);
 12
 313        var responseAsString = await response.Content.ReadAsStringAsync();
 314        var result = JsonConvert.DeserializeObject<LoginMfaOut>(responseAsString)!;
 15
 316        if (response.IsSuccessStatusCode && result.AccessToken != null)
 17        {
 118            await localStorage.SetItemAsync("AccessToken", result.AccessToken);
 119            authStateProvider.MarkUserAsAuthenticated();
 20        }
 21
 322        return result;
 323    }
 24}