| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- @page "/"
- @using Grpc.Net.Client
- @using Grpc.Net.Client.Web
- @using GrpcShared
- @using GrpcShared.DTO.Auth
- @using GrpcShared.DTO.Search
- @using NemAnBlazor.Services.Interfaces
- @inject NavigationManager NavigationManager
- @inject IAuthClientService AuthService
- @inject ITrackClientService SearchService
- @using System.Security.Claims
- @inject Blazored.LocalStorage.ILocalStorageService localStorage
-
-
-
- <AuthorizeView>
- <Authorized>
- <p>Dobrodosli @context.User.Claims.FirstOrDefault(x => x.Type == "name")?.Value.ToUpper()</p>
- </Authorized>
- <NotAuthorized>
- Nisi autorizovan.
- <button class="btn btn-primary" @onclick="LoginUser">Login</button>
- </NotAuthorized>
- </AuthorizeView>
-
- <PageTitle>Index</PageTitle>
-
- <h1>Pozdrav Diligent!</h1>
-
-
- Dobrodošli u našu NemAn aplikaciju.
-
-
-
-
- @code {
-
-
- protected override async Task OnInitializedAsync()
- {
- var userId = await localStorage.GetItemAsync<string>("user_info");
- if (userId != null) NavigationManager.NavigateTo("/home");
-
- }
- private async Task LoginUser()
- {
- //var response = await SearchService.GetListSearchAsync(new GrpcShared.DTO.Search.SearchRequest() { Query="venom", Type = "track"});
- CodeRequest authParams = await AuthService.GetAuthParams();
- // await AuthService.GetAccessToken(new CodeResponse{ Code = "hello"});
- string url = $"https://accounts.spotify.com/en/authorize?client_id={authParams.ClientId}&redirect_uri={authParams.RedirectURI}&response_type={authParams.ResponseType}&scope={authParams.Scope}&show_dialog={authParams.ShowDialog}";
-
- NavigationManager.NavigateTo(url);
-
- }
- }
|