refactor : code cleanliness
continuous-integration/drone/push Build is passing Details

Multiplayer_Php
Jade VAN BRABANDT 1 year ago
parent 90d72219ff
commit f6243f4703

@ -20,7 +20,7 @@ namespace Blazor.Modals
//private Chapter chapter = new Chapter();
//protected override async Task OnInitializedAsync()
//{
// // Get the chapter
// chapter = await DataService.GetById(Id);
//}

@ -1,6 +1,4 @@
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components;
using Blazor.Models;
using Blazor.Services;
@ -24,8 +22,6 @@ namespace Blazor.Pages.Admins
{
administratorModel.HashPassword(administratorModel.HashedPassword);
//await DataService.Add(administratorModel);
var formData = new List<KeyValuePair<string, string>>();
formData.Add(new KeyValuePair<string, string>("username", administratorModel.Username));
formData.Add(new KeyValuePair<string, string>("password", administratorModel.HashedPassword));

@ -2,14 +2,10 @@
using Blazorise.DataGrid;
using Blazor.ViewClasses;
using Blazor.Modals;
using Blazor.Models;
using Blazored.LocalStorage;
using Blazored.Modal.Services;
using Blazor.Modals;
using Blazor.Services;
using Blazored.Modal;
using Blazored.Modal;
using Blazor.Pages.Chapters;
namespace Blazor.Pages.Admins;
@ -43,7 +39,6 @@ public partial class Administrators
return;
}
// When you use a real API, we use this follow code
var response = Http.GetFromJsonAsync<Administrator[]>(API.API_URL+"administrators/"+API.TOKEN).Result;
if (!e.CancellationToken.IsCancellationRequested)
@ -87,9 +82,7 @@ public partial class Administrators
var errorResponse = await response.Content.ReadAsStringAsync();
}
}
//await DataService.Delete(id);
// Reload the page
NavigationManager.NavigateTo("administrators", true);
}
}

@ -31,7 +31,6 @@ namespace Blazor.Pages.Admins
var administrator = await DataService.GetAdminById(Id);
OldAdminName = administrator.Username;
// Set the model with the admin
administratorModel = new AdministratorModel
{
Id = administrator.Id,
@ -44,7 +43,6 @@ namespace Blazor.Pages.Admins
{
administratorModel.HashPassword(administratorModel.HashedPassword);
//await DataService.Update(Id, administratorModel);
var formData = new List<KeyValuePair<string, string>>();
formData.Add(new KeyValuePair<string, string>("username", administratorModel.Username));
formData.Add(new KeyValuePair<string, string>("password", administratorModel.HashedPassword));
@ -67,7 +65,6 @@ namespace Blazor.Pages.Admins
}
}
Logger.LogInformation("Admin '{OldAdminModelName}' edited in '{NewAdminModelName}'",OldAdminName,administratorModel.Username);
NavigationManager.NavigateTo("administrators");

@ -21,8 +21,6 @@ public partial class AddChapter
private async Task HandleValidSubmit()
{
//await DataService.Add(chapterModel);
var formData = new List<KeyValuePair<string, string>>();
formData.Add(new KeyValuePair<string, string>("name", chapterModel.Name));

@ -2,18 +2,13 @@
using Blazor.Services;
using Blazored.Modal.Services;
using Blazor.ViewClasses;
using System.Text;
using Microsoft.JSInterop;
using Microsoft.AspNetCore.Components;
using Blazorise.DataGrid;
using ChoETL;
using Microsoft.AspNetCore.Components.Forms;
using Blazor.Modals;
using Blazored.Modal;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Blazor.Models;
namespace Blazor.Pages.Chapters;
public partial class Chapters
{
public List<Chapter> chapters;
@ -68,23 +63,9 @@ public partial class Chapters
var errorResponse = await response.Content.ReadAsStringAsync();
}
}
// /api/delete/player/ +chapterid
//await DataService.Delete(id);
// Reload the page
NavigationManager.NavigateTo("chapters", true);
}
//protected override async Task OnAfterRenderAsync(bool firstRender)
//{
// if (!firstRender)
// {
// return;
// }
//}
private async Task OnReadData(DataGridReadDataEventArgs<Chapter> e)
{
if (e.CancellationToken.IsCancellationRequested)

@ -1,11 +0,0 @@
window.downloadFileFromStream = async (fileName, contentStreamReference) => {
const arrayBuffer = await contentStreamReference.arrayBuffer();
const blob = new Blob([arrayBuffer]);
const url = URL.createObjectURL(blob);
const anchorElement = document.createElement('a');
anchorElement.href = url;
anchorElement.download = fileName ?? '';
anchorElement.click();
anchorElement.remove();
URL.revokeObjectURL(url);
}

@ -30,7 +30,6 @@ public partial class EditChapter
var chapter = await DataService.GetById(Id);
OldChapterName = chapter.Name;
// Set the model with the chapter
chapterModel = new ChapterModel
{
Id = chapter.Id,
@ -40,7 +39,6 @@ public partial class EditChapter
private async Task HandleValidSubmit()
{
//await DataService.Update(Id, chapterModel);
var formData = new List<KeyValuePair<string, string>>();
formData.Add(new KeyValuePair<string, string>("name", chapterModel.Name));

@ -19,8 +19,6 @@ namespace Blazor.Pages.Players
{
playerModel.HashPassword(playerModel.HashedPassword);
//await DataService.Add(playerModel);
var formData = new List<KeyValuePair<string, string>>();
formData.Add(new KeyValuePair<string, string>("nickname", playerModel.Nickname));
formData.Add(new KeyValuePair<string, string>("password", playerModel.HashedPassword));

@ -1,8 +1,6 @@
using Blazor.Models;
using Blazor.Services;
using ChoETL;
using Microsoft.AspNetCore.Components;
using System.Runtime.InteropServices;
namespace Blazor.Pages.Players
{
@ -40,8 +38,6 @@ namespace Blazor.Pages.Players
{
playerModel.HashPassword(playerModel.HashedPassword);
//await DataService.Update(Id, playerModel);
var formData = new List<KeyValuePair<string, string>>();
formData.Add(new KeyValuePair<string, string>("nickname", playerModel.Nickname));
formData.Add(new KeyValuePair<string, string>("password", playerModel.HashedPassword));

@ -63,23 +63,9 @@ public partial class Players
var errorResponse = await response.Content.ReadAsStringAsync();
}
}
//await DataService.Delete(id);
// Reload the page
NavigationManager.NavigateTo("Players", true);
}
//protected override async Task OnAfterRenderAsync(bool firstRender)
//{
// // Do not treat this action if is not the first render
// if (!firstRender)
// {
// return;
// }
//}
private async Task OnReadData(DataGridReadDataEventArgs<Player> e)
{
if (e.CancellationToken.IsCancellationRequested)

@ -1,6 +1,4 @@
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components;
using Blazor.Models;
using Blazor.Services;
using Blazor.Pages.Admins;

@ -10,7 +10,6 @@ using ChoETL;
using Microsoft.AspNetCore.Components.Forms;
using Blazor.Modals;
using Blazored.Modal;
using Blazor.Pages.Admins;
using System.Text.RegularExpressions;
namespace Blazor.Pages.Questions;
@ -69,22 +68,9 @@ public partial class Questions
}
}
//await DataService.Delete(id);
// Reload the page
NavigationManager.NavigateTo("questions", true);
}
//protected override async Task OnAfterRenderAsync(bool firstRender)
//{
// // Do not treat this action if is not the first render
// if (!firstRender)
// {
// return;
// }
//}
private async Task OnReadData(DataGridReadDataEventArgs<Question> e)
{
if (e.CancellationToken.IsCancellationRequested)

Loading…
Cancel
Save