Fix creation of new creators
This commit is contained in:
@@ -48,9 +48,9 @@ public sealed class CreateCreatorHandler(
|
||||
.Slugs
|
||||
.SingleAsync(s => s.Id == req.SlugReservationId, ct);
|
||||
|
||||
if (slug.Active == false
|
||||
&& slug.ReservedUntil >= DateTime.Now
|
||||
&& slug.CreatedBy == User.GetUserId())
|
||||
if (slug.Active == true
|
||||
|| slug.ReservedUntil < DateTimeOffset.UtcNow
|
||||
|| slug.CreatedBy != User.GetUserId())
|
||||
{
|
||||
await SendErrorsAsync(500, ct);
|
||||
return;
|
||||
|
||||
@@ -14,7 +14,7 @@ export const useCreatorProfileStore = defineStore(
|
||||
() => authStore.isAuthenticated,
|
||||
async (newValue) => {
|
||||
if (newValue) {
|
||||
value.value = await fetchCurrentCreatorProfile();
|
||||
await fetchCurrentCreatorProfile();
|
||||
if (value.value === undefined) {
|
||||
await router.push('/');
|
||||
} else {
|
||||
@@ -28,7 +28,7 @@ export const useCreatorProfileStore = defineStore(
|
||||
|
||||
const value = useSessionStorage(
|
||||
'creator-profile',
|
||||
{},
|
||||
undefined,
|
||||
{writeDefaults: false}
|
||||
);
|
||||
|
||||
@@ -40,10 +40,10 @@ export const useCreatorProfileStore = defineStore(
|
||||
|
||||
async function fetchCurrentCreatorProfile() {
|
||||
try {
|
||||
const creatorResponse = await client.get(`/api/creators/profile`);
|
||||
return creatorResponse.data;
|
||||
const response = await client.get(`/api/creators/profile`);
|
||||
value.value = response.data;
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
value.value = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user