You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

57 lines
1.8 KiB

  1. @using BootStrapComponents
  2. @using Components
  3. @using Models.Identity
  4. @using Newtonsoft.Json
  5. @using BlazorPages.Tools
  6. @page "/"
  7. @layout LayoutWithoutMenu
  8. <img src="/assets/images/logo.png" class="@BT.CenterBlock m-2" style="max-width:30%;" />
  9. @if (DataGotten)
  10. {
  11. <button class="@BT.CenterBlock @BT.Button(ColorType.primary,outline:true) @BT.Background(ColorType.light) w-50 h-1"
  12. style="margin-top:calc(50vh - 10em);"
  13. @onclick="@(()=>NavManager.NavigateTo("/login"))">
  14. ورود و ثبت نام
  15. </button>
  16. }
  17. <div class="@BT.Row @BT.TextColor(ColorType.white) @BT.TextAlign(TextAlignment.center)" style="position:sticky;height:200px; top:calc(100vh - 200px);">
  18. <hr class="@BT.TextColor(ColorType.white)" />
  19. <p>
  20. © تمامی حقوق برای حقتو محفوظ میباشد
  21. </p>
  22. <br />
  23. <p>
  24. ورژن 1.0
  25. </p>
  26. </div>
  27. @code {
  28. public bool DataGotten { set; get; }
  29. protected override async void OnInitialized()
  30. {
  31. var hasToken = await LocalStorage.ContainKeyAsync(Statics.LoginTokenKey);
  32. if (hasToken)
  33. {
  34. var token = await LocalStorage.GetItemAsStringAsync(Statics.LoginTokenKey);
  35. var res = await _userUtils.CheckLogin(goToLogin: false);
  36. var result =
  37. JsonConvert.DeserializeObject<CheckLoginResponse>(
  38. await res.Content.ReadAsStringAsync());
  39. if (res.IsSuccessStatusCode)
  40. {
  41. await LoadingSpinner.HideLoading();
  42. Statics.CurrentLoginInfo = result;
  43. if (!result.HasName)
  44. NavManager.NavigateTo("/NameAndEmail");
  45. else
  46. NavManager.NavigateTo("/dashboard");
  47. }
  48. }
  49. DataGotten = true;
  50. StateHasChanged();
  51. }
  52. }