Compare commits

..

5 Commits

8 changed files with 32 additions and 25 deletions

View File

@ -2,5 +2,8 @@ export default defineAppConfig({
ui: { ui: {
primary: 'sky', primary: 'sky',
gray: 'cool', gray: 'cool',
container: {
constrained: 'max-w-full',
},
}, },
}) })

BIN
bun.lockb

Binary file not shown.

View File

@ -1,16 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import type { NavItem } from '@nuxt/content/dist/runtime/types'
const navigation = inject<Ref<NavItem[]>>('navigation')
const links = [{ const links = [{
label: 'Documentation', label: 'Documentation',
icon: 'i-heroicons-book-open', icon: 'i-heroicons-book-open',
to: '/getting-started', to: 'https://ui.nuxt.com/getting-started',
}, { }, {
label: 'Pro', label: 'Pro',
icon: 'i-heroicons-square-3-stack-3d', icon: 'i-heroicons-square-3-stack-3d',
to: '/pro', to: 'https://ui.nuxt.com/pro',
}, { }, {
label: 'Releases', label: 'Releases',
icon: 'i-heroicons-rocket-launch', icon: 'i-heroicons-rocket-launch',
@ -27,12 +23,11 @@ const links = [{
<template #right> <template #right>
<UColorModeButton /> <UColorModeButton />
<UButton to="#" target="_blank" icon="i-heroicons-user-solid" color="gray" variant="ghost" />
<UButton to="https://github.com/nuxt/ui" target="_blank" icon="i-simple-icons-github" color="gray" variant="ghost" />
</template> </template>
<template #panel> <template #panel>
<UNavigationTree :links="mapContentNavigation(navigation)" /> <UNavigationTree :links="links" />
</template> </template>
</UHeader> </UHeader>
</template> </template>

View File

@ -6,19 +6,19 @@ const links = [
children: [ children: [
{ {
label: 'Overview', label: 'Overview',
to: '/partner/overview', to: '/login',
icon: 'i-heroicons-eye', icon: 'i-heroicons-eye',
}, },
{ {
label: 'Add Company', label: 'Add Company',
to: '/pro/components/docs/docs-search', to: '/login',
icon: 'i-heroicons-plus-circle', icon: 'i-heroicons-plus-circle',
}, },
], ],
}, },
{ {
label: 'People', label: 'People',
to: '/pro/components/docs/docs-search-button', to: '/login',
icon: 'i-heroicons-user-group', icon: 'i-heroicons-user-group',
}, },
] ]

View File

@ -1,6 +1,12 @@
export interface User { export interface User {
id: number
name: string name: string
email?: string email: string
email_verified_at: string | null
password?: string
remember_token?: string | null
created_at: string | null
updated_at: string | null
} }
export interface LoginCredentials { export interface LoginCredentials {

View File

@ -1,9 +1,7 @@
export default defineNuxtRouteMiddleware(() => { export default defineNuxtRouteMiddleware(() => {
const user = useUser(); const user = useUser()
if (!user.value) return navigateTo("/login"); if (!user.value) { return navigateTo('/login') }
// @ts-ignore if (user.value.email_verified_at) { return navigateTo('/') }
if (user.value.email_verified_at || user.value.is_verified) })
return navigateTo("/");
});

View File

@ -14,8 +14,6 @@
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^1.1.0", "@antfu/eslint-config": "^1.1.0",
"@iconify-json/heroicons": "^1.1.13", "@iconify-json/heroicons": "^1.1.13",
"@iconify-json/logos": "^1.1.37",
"@iconify-json/simple-icons": "^1.1.76",
"@nuxt/devtools": "latest", "@nuxt/devtools": "latest",
"@nuxt/ui-pro": "^0.4.2", "@nuxt/ui-pro": "^0.4.2",
"eslint": "^8.53.0", "eslint": "^8.53.0",

View File

@ -9,6 +9,7 @@ export const $larafetch = $fetch.create({
async onRequest({ options }) { async onRequest({ options }) {
const { backendUrl, frontendUrl } = useRuntimeConfig().public const { backendUrl, frontendUrl } = useRuntimeConfig().public
const event = process.nitro ? useEvent() : null const event = process.nitro ? useEvent() : null
let token = event let token = event
? parseCookies(event)[CSRF_COOKIE] ? parseCookies(event)[CSRF_COOKIE]
: useCookie(CSRF_COOKIE).value : useCookie(CSRF_COOKIE).value
@ -46,17 +47,23 @@ export const $larafetch = $fetch.create({
}, },
async onResponseError({ response }) { async onResponseError({ response }) {
const status = response.status const status = response.status
if (status === 419) {
await initCsrf(true)
}
if ([500].includes(status)) { if ([500].includes(status)) {
console.error('[Laravel Error]', response.statusText, response._data) console.error('[Laravel Error]', response.statusText, response._data)
} }
}, },
}) })
async function initCsrf() { async function initCsrf(forceRefresh = false) {
const { backendUrl } = useRuntimeConfig().public const { backendUrl } = useRuntimeConfig().public
const existingToken = useCookie(CSRF_COOKIE).value const existingToken = useCookie(CSRF_COOKIE).value
if (existingToken) { return existingToken } if (existingToken && !forceRefresh) {
return existingToken
}
await $fetch('/sanctum/csrf-cookie', { await $fetch('/sanctum/csrf-cookie', {
baseURL: backendUrl, baseURL: backendUrl,