Skip to content

Commit

Permalink
fix exception when you're not logged in yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargaj committed Sep 12, 2024
1 parent 8eeecec commit 3b02805
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
8 changes: 5 additions & 3 deletions BlueWP.ATProto/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ protected async Task<T> RequestAsync<T>(string method, ILexicon input) where T :
headers["Content-Type"] = rawPost.MimeType;
}

headers["Authorization"] = $"Bearer {CurrentAccountSettings.Credentials.AccessToken}";

(input as ICustomHeaderProvider)?.SetCustomHeaders(headers, _settings.CurrentAccountSettings);
if (CurrentAccountSettings != null)
{
headers["Authorization"] = $"Bearer {CurrentAccountSettings.Credentials.AccessToken}";
(input as ICustomHeaderProvider)?.SetCustomHeaders(headers, CurrentAccountSettings);
}

var url = $"{CurrentEndpoint}/xrpc/{input.EndpointID}";
string responseJson = null;
Expand Down
2 changes: 1 addition & 1 deletion BlueWP/Controls/Post/PostSelected.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</Border>

<!-- quote post -->
<Button BorderThickness="1" Click="QuotedPost_Click" Background="Transparent" BorderBrush="{ThemeResource AppBarItemDisabledForegroundThemeBrush}" Padding="5">
<Button BorderThickness="1" Click="QuotedPost_Click" Background="Transparent" BorderBrush="{ThemeResource AppBarItemDisabledForegroundThemeBrush}" Padding="5">
<i:Interaction.Behaviors>
<c:DataTriggerBehavior Binding="{Binding HasQuotedPost}" Value="True">
<c:ChangePropertyAction PropertyName="Visibility" Value="Visible" />
Expand Down
11 changes: 9 additions & 2 deletions BlueWP/Pages/LoginPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System;
using System.ComponentModel;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

Expand Down Expand Up @@ -37,7 +38,13 @@ private async void Login_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
}
else
{
// TODO: handle error
var dialog = new ContentDialog
{
Content = new TextBlock { Text = $"Login failed!" },
Title = $"Login failed!",
PrimaryButtonText = "Ok :(",
};
await dialog.ShowAsync();
}
}

Expand Down

0 comments on commit 3b02805

Please sign in to comment.