This commit is contained in:
mmrbnjd
2024-05-08 17:25:02 +03:30
parent d74f3dadf3
commit 716f02baa1
14 changed files with 376 additions and 179 deletions

View File

@@ -0,0 +1,12 @@
namespace Front.Services
{
public static class ExMethod
{
public static T Clone<T>(this T obj)
{
var inst = obj.GetType().GetMethod("MemberwiseClone", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
return (T)inst?.Invoke(obj, null);
}
}
}

View File

@@ -24,6 +24,13 @@ namespace Front.Services
_nav.NavigateTo("/Sign-in/unon");
return request;
}
public async Task<HttpResponseMessage> Delete(string route)
{
var request = await _hc.DeleteAsync(route);
if (request.StatusCode == System.Net.HttpStatusCode.Unauthorized)
_nav.NavigateTo("/Sign-in/unon");
return request;
}
public async Task<HttpResponseMessage> Post<T>(string route,T mode)
{
var request = await _hc.PostAsJsonAsync(route,mode);

View File

@@ -9,6 +9,7 @@ namespace Front.Services
{
_user = user;
}
public async Task<bool> OnlineUser()
{
if (_user != null && !string.IsNullOrEmpty(_user.Token) && _user.exitDate.AddMinutes(-5) > DateTime.Now)