LANCommander/LANCommander.Launcher/UI/Components/ReportIssueDialog.razor

44 lines
1.2 KiB
Text
Raw Permalink Normal View History

@using BootstrapBlazor.Components
@inherits FeedbackComponent<Data.Models.Game, SDK.Models.Issue>
@inject SDK.Client Client
@inject IMessageService MessageService
@inject LocalizationService LocalizationService
<Form Model="Issue">
2024-09-09 18:20:27 -05:00
<FormItem Style="margin-bottom: 0">
<TextArea @bind-Value="@context.Description" MinRows="10" />
</FormItem>
</Form>
@code {
SDK.Models.Issue Issue { get; set; } = new SDK.Models.Issue();
public override async Task OnFeedbackOkAsync(ModalClosingEventArgs args)
{
try {
Issue.GameId = Options.Id;
var success = await Client.Issues.Open(Issue.Description, Issue.GameId);
if (success)
{
MessageService.Success(LocalizationService.GetString("IssueReported"));
await base.FeedbackRef.CloseAsync();
}
else
{
MessageService.Error(LocalizationService.GetString("UnknownErrorIssueNotReported"));
args.Reject();
}
}
catch (Exception ex)
{
MessageService.Error(LocalizationService.GetString("UnknownErrorIssueNotReported"));
args.Reject();
}
}
}