Compare commits
5 Commits
85fb966491
...
9fc830a98b
| Author | SHA1 | Date |
|---|---|---|
|
|
9fc830a98b | |
|
|
29b395d695 | |
|
|
b548676fd3 | |
|
|
2191edf6bf | |
|
|
f2ba1e3565 |
|
|
@ -2,5 +2,8 @@ export default defineAppConfig({
|
|||
ui: {
|
||||
primary: 'sky',
|
||||
gray: 'cool',
|
||||
container: {
|
||||
constrained: 'max-w-full',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
<script setup lang="ts">
|
||||
import type { NavItem } from '@nuxt/content/dist/runtime/types'
|
||||
|
||||
const navigation = inject<Ref<NavItem[]>>('navigation')
|
||||
|
||||
const links = [{
|
||||
label: 'Documentation',
|
||||
icon: 'i-heroicons-book-open',
|
||||
to: '/getting-started',
|
||||
to: 'https://ui.nuxt.com/getting-started',
|
||||
}, {
|
||||
label: 'Pro',
|
||||
icon: 'i-heroicons-square-3-stack-3d',
|
||||
to: '/pro',
|
||||
to: 'https://ui.nuxt.com/pro',
|
||||
}, {
|
||||
label: 'Releases',
|
||||
icon: 'i-heroicons-rocket-launch',
|
||||
|
|
@ -27,12 +23,11 @@ const links = [{
|
|||
|
||||
<template #right>
|
||||
<UColorModeButton />
|
||||
|
||||
<UButton to="https://github.com/nuxt/ui" target="_blank" icon="i-simple-icons-github" color="gray" variant="ghost" />
|
||||
<UButton to="#" target="_blank" icon="i-heroicons-user-solid" color="gray" variant="ghost" />
|
||||
</template>
|
||||
|
||||
<template #panel>
|
||||
<UNavigationTree :links="mapContentNavigation(navigation)" />
|
||||
<UNavigationTree :links="links" />
|
||||
</template>
|
||||
</UHeader>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -6,19 +6,19 @@ const links = [
|
|||
children: [
|
||||
{
|
||||
label: 'Overview',
|
||||
to: '/partner/overview',
|
||||
to: '/login',
|
||||
icon: 'i-heroicons-eye',
|
||||
},
|
||||
{
|
||||
label: 'Add Company',
|
||||
to: '/pro/components/docs/docs-search',
|
||||
to: '/login',
|
||||
icon: 'i-heroicons-plus-circle',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'People',
|
||||
to: '/pro/components/docs/docs-search-button',
|
||||
to: '/login',
|
||||
icon: 'i-heroicons-user-group',
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
export interface User {
|
||||
id: number
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
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 || user.value.is_verified)
|
||||
return navigateTo("/");
|
||||
});
|
||||
if (user.value.email_verified_at) { return navigateTo('/') }
|
||||
})
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^1.1.0",
|
||||
"@iconify-json/heroicons": "^1.1.13",
|
||||
"@iconify-json/logos": "^1.1.37",
|
||||
"@iconify-json/simple-icons": "^1.1.76",
|
||||
"@nuxt/devtools": "latest",
|
||||
"@nuxt/ui-pro": "^0.4.2",
|
||||
"eslint": "^8.53.0",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ export const $larafetch = $fetch.create({
|
|||
async onRequest({ options }) {
|
||||
const { backendUrl, frontendUrl } = useRuntimeConfig().public
|
||||
const event = process.nitro ? useEvent() : null
|
||||
|
||||
let token = event
|
||||
? parseCookies(event)[CSRF_COOKIE]
|
||||
: useCookie(CSRF_COOKIE).value
|
||||
|
|
@ -46,17 +47,23 @@ export const $larafetch = $fetch.create({
|
|||
},
|
||||
async onResponseError({ response }) {
|
||||
const status = response.status
|
||||
|
||||
if (status === 419) {
|
||||
await initCsrf(true)
|
||||
}
|
||||
if ([500].includes(status)) {
|
||||
console.error('[Laravel Error]', response.statusText, response._data)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
async function initCsrf() {
|
||||
async function initCsrf(forceRefresh = false) {
|
||||
const { backendUrl } = useRuntimeConfig().public
|
||||
const existingToken = useCookie(CSRF_COOKIE).value
|
||||
|
||||
if (existingToken) { return existingToken }
|
||||
if (existingToken && !forceRefresh) {
|
||||
return existingToken
|
||||
}
|
||||
|
||||
await $fetch('/sanctum/csrf-cookie', {
|
||||
baseURL: backendUrl,
|
||||
|
|
|
|||
Loading…
Reference in New Issue