Switched to net9 and finished event workflow
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SpotifyAPI.Web;
|
||||
using SpotiParty.Web.Models;
|
||||
using SpotiParty.Web.Services;
|
||||
|
||||
namespace SpotiParty.Web.Components.Pages;
|
||||
@@ -9,6 +10,8 @@ public partial class EnqueuePage(AuthorizationHandler authHandler, NavigationMan
|
||||
|
||||
[Parameter]
|
||||
public string EventId { get; set; } = string.Empty;
|
||||
|
||||
private Event? _event;
|
||||
|
||||
private readonly int _currentYear = DateTime.Now.Year;
|
||||
private SpotifyClient _client = null!;
|
||||
@@ -28,22 +31,24 @@ public partial class EnqueuePage(AuthorizationHandler authHandler, NavigationMan
|
||||
return;
|
||||
}
|
||||
|
||||
var eventEntry = await context.Events
|
||||
_event = await context.Events
|
||||
.Include(e => e.Host)
|
||||
.FirstOrDefaultAsync(e => e.Id == guid);
|
||||
|
||||
if (eventEntry is null) {
|
||||
navigator.NavigateTo("/", forceLoad: true);
|
||||
return;
|
||||
}
|
||||
|
||||
var now = DateTime.Now;
|
||||
if (eventEntry.Start > now || eventEntry.End < now) {
|
||||
if (_event is null) {
|
||||
navigator.NavigateTo("/", forceLoad: true);
|
||||
return;
|
||||
}
|
||||
|
||||
var client = await authHandler.ConfigureClient(eventEntry.Host.UserId);
|
||||
StateHasChanged();
|
||||
|
||||
var now = DateTime.Now;
|
||||
if (_event.Start > now || _event.End < now) {
|
||||
navigator.NavigateTo("/", forceLoad: true);
|
||||
return;
|
||||
}
|
||||
|
||||
var client = await authHandler.ConfigureClient(_event.Host.UserId);
|
||||
|
||||
if (client is null) {
|
||||
navigator.NavigateTo("/", forceLoad: true);
|
||||
|
||||
Reference in New Issue
Block a user