better server side signin redirects

this makes it so if a user requests a page (not API route) and isn't
signed in, it automatically redirects them to the sign in page (doesn't
show a flash of the error page)
This commit is contained in:
DecDuck
2024-10-23 12:55:38 +11:00
parent c4a3e4e9a7
commit ef13b68592
4 changed files with 136 additions and 88 deletions

View File

@@ -1,19 +1,46 @@
<template>
<NuxtLink v-if="game" :href="`/store/${game.id}`" class="rounded overflow-hidden w-48 h-64 group relative transition-all duration-300 hover:scale-105 hover:shadow-xl">
<img :src="useObject(game.mCoverId)" class="w-full h-full object-cover" />
<div class="absolute inset-0 bg-gradient-to-b from-transparent to-90% to-zinc-800"/>
<div class="absolute bottom-0 left-0 px-2 py-1.5">
<h1 class="text-zinc-100 text-sm font-bold font-display">{{ game.mName }}</h1>
<p class="text-zinc-400 text-xs">{{ game.mShortDescription.split(" ").slice(0, 10).join(" ") }}...</p>
<NuxtLink
v-if="game"
:href="`/store/${game.id}`"
class="rounded overflow-hidden w-48 h-64 group relative transition-all duration-300 hover:scale-105 hover:shadow-xl"
>
<img
:src="useObject(game.mCoverId)"
class="w-full h-full object-cover"
/>
<div
class="absolute inset-0 bg-gradient-to-b from-transparent to-90% to-zinc-800"
/>
<div class="absolute bottom-0 left-0 px-2 py-1.5">
<h1 class="text-zinc-100 text-sm font-bold font-display">
{{ game.mName }}
</h1>
<p class="text-zinc-400 text-xs">
{{
game.mShortDescription.split(" ").slice(0, 10).join(" ")
}}...
</p>
</div>
</NuxtLink>
<div
v-else
class="rounded w-48 h-64 bg-zinc-800 flex items-center justify-center"
>
<p class="text-zinc-700 text-sm font-semibold font-display uppercase">
no game
</p>
</div>
</NuxtLink>
<div v-else class="rounded w-48 h-64 bg-zinc-800 flex items-center justify-center">
<p class="text-zinc-700 text-sm font-semibold font-display uppercase">no game</p>
</div>
</template>
<script setup lang="ts">
import type { SerializeObject } from "nitropack";
const props = defineProps<{ game?: SerializeObject<{ id: string, mCoverId: string, mName: string, mShortDescription: string }> }>();
const props = defineProps<{
game?: SerializeObject<{
id: string;
mCoverId: string;
mName: string;
mShortDescription: string;
}>;
}>();
</script>