@using hassio_onedrive_backup.Graph;
@inherits LayoutComponentBase
@inject NavigationManager NavigationManager
@inject IGraphHelper GraphHelper
@inject IJSRuntime JS
@if (GraphHelper.IsAuthenticated == false)
{
Not logged in! To sign in to OneDrive, navigate to
@GraphHelper.AuthUrl and enter the code
@GraphHelper.AuthCode
to authenticate.
}
@Body
@code{
protected override void OnInitialized()
{
base.OnInitialized();
GraphHelper.AuthStatusChangedEventHandler += OnStateChanged;
}
private void CopyCodeToClipboard()
{
JS.InvokeVoidAsync("copyToClipboard", GraphHelper.AuthCode);
}
private async void OnStateChanged()
{
await InvokeAsync(() =>
{
StateHasChanged();
});
}
}