feat : Ajout token Get Post Delete
continuous-integration/drone/push Build is passing Details

Multiplayer_Php
Jeremy DUCOURTHIAL 1 year ago
parent a1bf965d02
commit 539adefee7

@ -32,7 +32,7 @@ namespace Blazor.Pages.Admins
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/administrator"; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/administrator/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -45,7 +45,7 @@ public partial class Administrators
// When you use a real API, we use this follow code // When you use a real API, we use this follow code
//var response = await Http.GetFromJsonAsync<ChaptersModel[]>( $"https://trusting-panini.87-106-126-109.plesk.page/api/administrators?page={e.Page}&pageSize={e.PageSize}" ); //var response = await Http.GetFromJsonAsync<ChaptersModel[]>( $"https://trusting-panini.87-106-126-109.plesk.page/api/administrators?page={e.Page}&pageSize={e.PageSize}" );
var response = Http.GetFromJsonAsync<Administrator[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/administrators").Result; var response = Http.GetFromJsonAsync<Administrator[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/administrators/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
if (!e.CancellationToken.IsCancellationRequested) if (!e.CancellationToken.IsCancellationRequested)
{ {
@ -54,7 +54,7 @@ public partial class Administrators
var currentData = await LocalStorage.GetItemAsync<Administrator[]>("data"); var currentData = await LocalStorage.GetItemAsync<Administrator[]>("data");
if (currentData == null || currentData.Length != administrators.Count) if (currentData == null || currentData.Length != administrators.Count)
{ {
var originalData = Http.GetFromJsonAsync<Administrator[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/administrators").Result; var originalData = Http.GetFromJsonAsync<Administrator[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/administrators/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
await LocalStorage.SetItemAsync("data", originalData); await LocalStorage.SetItemAsync("data", originalData);
} }
} }

@ -51,7 +51,7 @@ namespace Blazor.Pages.Admins
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/update/administrator/" + administratorModel.Id; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/update/administrator/" + administratorModel.Id + "/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -29,7 +29,7 @@ public partial class AddChapter
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/chapter"; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/chapter/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -92,7 +92,7 @@ public partial class Chapters
return; return;
} }
var response = Http.GetFromJsonAsync<Chapter[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters").Result; var response = Http.GetFromJsonAsync<Chapter[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
if (!e.CancellationToken.IsCancellationRequested) if (!e.CancellationToken.IsCancellationRequested)
{ {
@ -101,7 +101,7 @@ public partial class Chapters
var currentData = await LocalStorage.GetItemAsync<Chapter[]>("data"); var currentData = await LocalStorage.GetItemAsync<Chapter[]>("data");
if (currentData == null || currentData.Length != chapters.Count) if (currentData == null || currentData.Length != chapters.Count)
{ {
var originalData = Http.GetFromJsonAsync<Chapter[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters").Result; var originalData = Http.GetFromJsonAsync<Chapter[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
await LocalStorage.SetItemAsync("data", originalData); await LocalStorage.SetItemAsync("data", originalData);
} }
} }
@ -110,7 +110,7 @@ public partial class Chapters
private async void Export() private async void Export()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
HttpResponseMessage response = await Http.GetAsync("https://trusting-panini.87-106-126-109.plesk.page/api/chapters"); HttpResponseMessage response = await Http.GetAsync("https://trusting-panini.87-106-126-109.plesk.page/api/chapters/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO");
var json = await response.Content.ReadAsStringAsync(); var json = await response.Content.ReadAsStringAsync();
using (var jsonFile = ChoJSONReader.LoadText(json)) using (var jsonFile = ChoJSONReader.LoadText(json))
{ {
@ -169,7 +169,7 @@ public partial class Chapters
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/chapter"; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/chapter/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -48,7 +48,7 @@ public partial class EditChapter
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/update/chapter/"+chapterModel.Id; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/update/chapter/" + chapterModel.Id + "/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -27,7 +27,7 @@ namespace Blazor.Pages.Players
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/players/"+playerModel.Id; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/player/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -2,6 +2,7 @@
using Blazor.Services; using Blazor.Services;
using ChoETL; using ChoETL;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using System.Runtime.InteropServices;
namespace Blazor.Pages.Players namespace Blazor.Pages.Players
{ {
@ -47,7 +48,7 @@ namespace Blazor.Pages.Players
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/update/player/"+playerModel.Id; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/update/player/" + playerModel.Id + "/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -92,7 +92,7 @@ public partial class Players
return; return;
} }
var response = Http.GetFromJsonAsync<Player[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/players").Result; var response = Http.GetFromJsonAsync<Player[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/players/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
if (!e.CancellationToken.IsCancellationRequested) if (!e.CancellationToken.IsCancellationRequested)
{ {
@ -101,7 +101,7 @@ public partial class Players
var currentData = await LocalStorage.GetItemAsync<Player[]>("data"); var currentData = await LocalStorage.GetItemAsync<Player[]>("data");
if (currentData == null || currentData.Length != players.Count) if (currentData == null || currentData.Length != players.Count)
{ {
var originalData = Http.GetFromJsonAsync<Player[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/players").Result; var originalData = Http.GetFromJsonAsync<Player[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/players/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
await LocalStorage.SetItemAsync("data", originalData); await LocalStorage.SetItemAsync("data", originalData);
} }
} }

@ -31,7 +31,7 @@ namespace Blazor.Pages.Questions
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/administrator"; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/administrator/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -35,7 +35,7 @@ namespace Blazor.Pages.Questions
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/update/questions/" + questionModel.Id; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/update/questions/" + questionModel.Id + "/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {

@ -106,7 +106,7 @@ public partial class Questions
if (currentData == null) if (currentData == null)
{ {
// this code add in the local storage the fake data (we load the data sync for initialize the data before load the OnReadData method) // this code add in the local storage the fake data (we load the data sync for initialize the data before load the OnReadData method)
var originalData = Http.GetFromJsonAsync<Question[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters").Result; var originalData = Http.GetFromJsonAsync<Question[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
await LocalStorage.SetItemAsync("data", originalData); await LocalStorage.SetItemAsync("data", originalData);
} }
} }
@ -115,7 +115,7 @@ public partial class Questions
private async void Export() private async void Export()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
HttpResponseMessage response = await Http.GetAsync("https://trusting-panini.87-106-126-109.plesk.page/api/questionsExport"); HttpResponseMessage response = await Http.GetAsync("https://trusting-panini.87-106-126-109.plesk.page/api/questionsExport/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO");
var json = await response.Content.ReadAsStringAsync(); var json = await response.Content.ReadAsStringAsync();
using (var jsonFile = ChoJSONReader.LoadText(json)) using (var jsonFile = ChoJSONReader.LoadText(json))
{ {
@ -156,7 +156,7 @@ public partial class Questions
formData.Add(new KeyValuePair<string, string>("answerContent4", field[5])); formData.Add(new KeyValuePair<string, string>("answerContent4", field[5]));
formData.Add(new KeyValuePair<string, string>("idanswergood", field[6])); formData.Add(new KeyValuePair<string, string>("idanswergood", field[6]));
string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/chapters/name/"+field[1]; string apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/chapters/name/"+field[1] + "/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
var response = await Http.GetAsync(apiUri); var response = await Http.GetAsync(apiUri);
@ -175,7 +175,7 @@ public partial class Questions
} }
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/questions"; apiUri = "https://trusting-panini.87-106-126-109.plesk.page/api/add/questions/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO";
response = await Http.PostAsync(apiUri, formContent); response = await Http.PostAsync(apiUri, formContent);

@ -29,7 +29,7 @@ namespace Blazor.Services
public async Task<Chapter> GetById(int id) public async Task<Chapter> GetById(int id)
{ {
// Get the current data // Get the current data
var currentData = _http.GetFromJsonAsync<List<Chapter>>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters").Result; var currentData = _http.GetFromJsonAsync<List<Chapter>>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
// Get the chapter int the list // Get the chapter int the list
var chapter = currentData.FirstOrDefault(w => w.Id == id); var chapter = currentData.FirstOrDefault(w => w.Id == id);
@ -89,7 +89,7 @@ namespace Blazor.Services
{ {
// Get the current data // Get the current data
//var currentData = await _localStorage.GetItemAsync<List<Chapter>>("data"); //var currentData = await _localStorage.GetItemAsync<List<Chapter>>("data");
var currentData = _http.GetFromJsonAsync<List<Chapter>>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters").Result; var currentData = _http.GetFromJsonAsync<List<Chapter>>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
// Get the chapter int the list // Get the chapter int the list
var chapter = currentData.FirstOrDefault(w => w.Id == id); var chapter = currentData.FirstOrDefault(w => w.Id == id);
@ -136,7 +136,7 @@ namespace Blazor.Services
public async Task<Administrator> GetAdminById(int id) public async Task<Administrator> GetAdminById(int id)
{ {
// Get the current data // Get the current data
var currentData = _http.GetFromJsonAsync<List<Administrator>>($"https://trusting-panini.87-106-126-109.plesk.page/api/administrators").Result; var currentData = _http.GetFromJsonAsync<List<Administrator>>($"https://trusting-panini.87-106-126-109.plesk.page/api/administrators/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
// Get the admin int the list // Get the admin int the list
var admin = currentData.FirstOrDefault(w => w.Id == id); var admin = currentData.FirstOrDefault(w => w.Id == id);
@ -229,7 +229,7 @@ namespace Blazor.Services
public async Task<Question> GetQuestionById(int id) public async Task<Question> GetQuestionById(int id)
{ {
// Get the current data // Get the current data
var currentData = _http.GetFromJsonAsync<List<Question>>($"https://trusting-panini.87-106-126-109.plesk.page/api/questions").Result; var currentData = _http.GetFromJsonAsync<List<Question>>($"https://trusting-panini.87-106-126-109.plesk.page/api/questions/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
// Get the question int the list // Get the question int the list
var question = currentData.FirstOrDefault(w => w.Id == id); var question = currentData.FirstOrDefault(w => w.Id == id);
@ -321,7 +321,7 @@ namespace Blazor.Services
public async Task<Player> GetPlayerById(int id) public async Task<Player> GetPlayerById(int id)
{ {
// Get the current data // Get the current data
var currentData = _http.GetFromJsonAsync<List<Player>>($"https://trusting-panini.87-106-126-109.plesk.page/api/players").Result; var currentData = _http.GetFromJsonAsync<List<Player>>($"https://trusting-panini.87-106-126-109.plesk.page/api/players/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
// Get the player in the list // Get the player in the list
var player = currentData.FirstOrDefault(w => w.Id == id); var player = currentData.FirstOrDefault(w => w.Id == id);

Loading…
Cancel
Save