This commit is contained in:
Juhász Ervin 2026-01-02 10:29:43 +01:00
parent c22430cdb9
commit 724550745a
23 changed files with 317 additions and 77 deletions

View File

@ -44,4 +44,33 @@
1766567819-999:59
1766627818- 5:26
1766745865- 1:03
1766745972- 0:00
1766745972- 0:18
1766750094- 3:08
1766750709- 0:01
1767040128- 9:51
1767041161- 0:22
1767041921- 14:15
1767043405- 10:42
1767044635- 3:33
1767045452- 0:00
1767126192- 0:08
1767126849- 30:00
1767131581- 5:29
1767132321-185:10
1767171670-188:07
1767210073- 9:39
1767211444- 0:04
1767211861- 0:00
1767220551- 3:19
1767221303- 0:00
1767260442- 2:58
1767284298- 0:00
1767292714- 3:54
1767307670- 4:05
1767308254- 1:10
1767308644- 4:02
1767309280- 4:02
1767339059- 0:21
1767339386- 2:51
1767340009- 87:57
1767345728- 7:30

36
app.vue
View File

@ -8,49 +8,17 @@
import 'primeicons/primeicons.css'
const siteData = ref()
const nuxtApp = useNuxtApp()
const categoriesStore = useCategoriesStore()
const placeStore = useMyPlacesStore()
const authStore = useAuthStore()
const configStore = useMyConfigStore()
const { loadToken, getToken } = useAuthToken()
async function loadData() {
// Először betöltjük a tokent (natív appnál Preferences-ből)
await loadToken()
const token = getToken()
const { data } = await useFetch('https://olcsoberauto.hu/rest/init',
{
headers: {
'auth-key': token || ''
}
}
)
if (data.value?.user) {
authStore.user = data.value.user
console.log(data.value.user)
}
if (data.value?.config) {
configStore.config = data.value.config
}
if (data.value?.states) {
configStore.states = data.value.states
}
if (data.value?.categories) {
categoriesStore.categories = data.value.categories
placeStore.places = data.value.places
}
}
nuxtApp.hooks.hook('app:mounted', async () => {
console.log('mounted...')
await loadData()
})
</script>
@ -75,7 +43,8 @@ html {
}
/* Jobb görgetési élmény */
html, body {
html,
body {
overscroll-behavior: none;
}
@ -130,4 +99,5 @@ body:has(.card-loading) {
pre {
font-size: 13px;
}
</style>

43
composables/useApi.ts Normal file
View File

@ -0,0 +1,43 @@
/**
* Központi API composable
* Az összes API hívás ezen keresztül történik
*/
export const useApi = () => {
const config = useRuntimeConfig()
const baseUrl = config.public.apiBase as string
/**
* API végpont URL összeállítása
*/
const getUrl = (endpoint: string): string => {
// Ha már teljes URL, visszaadjuk
if (endpoint.startsWith('http')) {
return endpoint
}
// Biztosítjuk, hogy az endpoint /-vel kezdődjön
const path = endpoint.startsWith('/') ? endpoint : `/${endpoint}`
return `${baseUrl}${path}`
}
/**
* useFetch wrapper az API hívásokhoz
*/
const apiFetch = <T>(endpoint: string, options?: Parameters<typeof useFetch>[1]) => {
return useFetch<T>(getUrl(endpoint), options)
}
/**
* $fetch wrapper az API hívásokhoz (nem reaktív, közvetlen hívás)
*/
const apiRequest = <T>(endpoint: string, options?: Parameters<typeof $fetch>[1]) => {
return $fetch<T>(getUrl(endpoint), options)
}
return {
baseUrl,
getUrl,
apiFetch,
apiRequest
}
}

View File

@ -42,4 +42,12 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
if (missingFields.length > 0) {
return navigateTo('/profile')
}
// Ha foglalás oldalon vagyunk
if (to.fullPath.match(/^\/rent/gi)) {
// console.log(authStore.rent)
// if(!authStore.rent?.auto_felvetel_datum){
// return navigateTo('/rent/date-from')
// }
}
})

View File

@ -2,12 +2,20 @@ import * as path from "path";
export default defineNuxtConfig({
compatibilityDate: '2024-12-29',
runtimeConfig: {
public: {
apiBase: process.env.NUXT_PUBLIC_API_BASE || 'https://olcsoberauto.hu/rest'
}
},
devServer: {
host: '0.0.0.0',
port: 3280
},
ssr: false,
modules: ["@primevue/nuxt-module", "@pinia/nuxt", "@nuxt/icon", "@vite-pwa/nuxt"],
modules: ["@primevue/nuxt-module", "@pinia/nuxt", "@pinia-plugin-persistedstate/nuxt", "@nuxt/icon", "@vite-pwa/nuxt"],
piniaPluginPersistedstate: {
storage: 'localStorage'
},
css: ['@/assets/styles/tailwind.css', '@/assets/styles/base.css', '@/assets/styles/fonts.css'],
primevue: {
options: {

View File

@ -1,8 +1,8 @@
{
"name": "nuxt-app",
"type": "module",
"version": "1.0.2",
"versionCode": 3,
"version": "1.0.4",
"versionCode": 4,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
@ -39,6 +39,7 @@
"@capacitor/preferences": "^8.0.0",
"@capacitor/splash-screen": "^8.0.0",
"@capacitor/status-bar": "^8.0.0",
"@pinia-plugin-persistedstate/nuxt": "^1.2.1",
"primeicons": "^7.0.0",
"primevue": "^4.3.9",
"tailwindcss": "^3.4.17",

View File

@ -44,7 +44,7 @@ function logOut(){
<div class="min-h-12 bg-neutral-800 flex justify-between items-center pe-2">
<div @click="$router.push({ path: '/' })"
class="bg-neutral-800 h-12 flex items-center shadow-lg bg-gradient-to-r from-neutral-800 dark:from-neutral-900 to-transparent">
<img src="/euro_cars_rent_a_car_logo.png" class="h-8 mx-3" />
<img src="/euro_cars_rent_a_car_logo.svg" class="h-8 mx-3" />
</div>
<div>
<Drawer v-model:visible="menuShow" header=" " position="right" :pt="{ root: 'border-0' }">

View File

@ -4,7 +4,7 @@
<div class="flex flex-col gap-3 items-center justify-center text-center">
<div @click="$router.push({path:'/'})"
class="w-48 bg-neutral-600 p-5 flex items-end rounded-ee-xl rounded-es-xl shadow-lg bg-gradient-to-b from-neutral-300 dark:from-black to-transparent">
<img src="/euro_cars_rent_a_car_logo.png" class="w-full" />
<img src="/euro_cars_rent_a_car_logo.svg" class="w-full" />
</div>
<NuxtPage />
</div>

View File

@ -2,6 +2,7 @@
<script lang="ts" setup>
const auth = useAuthStore()
const { setToken, loadToken, getToken } = useAuthToken()
const { apiFetch } = useApi()
const loginCode = ref()
const loginCodePrefix = ref()
@ -17,7 +18,7 @@ async function sendCode() {
isLoading.value = true
errorMessage.value = false
successMessage.value = false
const { data } = await useFetch('https://olcsoberauto.hu/rest/tokenRequest', {
const { data } = await apiFetch('/tokenRequest', {
method: "post",
body: {
account: account.value,

View File

@ -20,7 +20,7 @@
</div>
</template>
</Card>
{{ token }}
<div class="text-center text-xs mt-5" v-if="configStore?.config">
<NuxtLink :to="'/page/' + configStore?.config?.adatvedelem_id">Adatvédelmi nyilatkozat</NuxtLink>
</div>
@ -28,7 +28,9 @@
</template>
<script lang="ts" setup>
const token = useAuthToken()
const configStore = useMyConfigStore()
const { apiFetch } = useApi()
const errorMessage = ref()
const successMessage = ref()
const isLoading = ref()
@ -40,7 +42,7 @@ async function sendAccount() {
successMessage.value = false
isLoading.value = true
const { data } = await useFetch('https://olcsoberauto.hu/rest/authRequest', {
const { data } = await apiFetch('/authRequest', {
method: "post",
body: {
account: account.value

View File

@ -21,9 +21,10 @@
const Content = ref()
const route = useRoute()
const isLoading = ref(true)
const { apiFetch } = useApi()
onMounted(async()=>{
const {data} = await useFetch('https://olcsoberauto.hu/rest/getPage', { query:{id:route.params.id}})
const {data} = await apiFetch('/getPage', { query:{id:route.params.id}})
if(data.value?.success){
Title.value = data.value?.page.post_title
Content.value = data.value?.page.post_content

View File

@ -72,6 +72,10 @@
<i :class="dialogType === 'success' ? 'pi pi-check-circle text-green-500' : 'pi pi-times-circle text-red-500'" style="font-size: 2rem"></i>
<span>{{ dialogMessage }}</span>
</div>
<div class="border-b border border-red-500 mt-3 mb-2" v-if="dialogErrors"></div>
<div v-for="err in dialogErrors" class="text-sm">
&bull; {{ err }}
</div>
<template #footer>
<Button label="Rendben" @click="showDialog = false" class="w-full" />
</template>
@ -92,10 +96,12 @@ const isLoading = ref(false)
const sameAddress = ref(true)
const authStore = useAuthStore()
const { user, rent } = storeToRefs(authStore)
const { getToken } = useAuthToken()
const { loadToken } = useAuthToken()
const { apiRequest } = useApi()
const showDialog = ref(false)
const dialogType = ref<'success' | 'error'>('success')
const dialogMessage = ref('')
const dialogErrors = ref()
// Kötelező mezők listája
const requiredFields = [
@ -123,8 +129,10 @@ const hasAllRequiredData = computed(() => {
async function save() {
isLoading.value = true
const token = getToken()
const data = await $fetch<{ success: boolean; message: string }>('https://olcsoberauto.hu/rest/update_profile',
const token = await loadToken()
console.log(token)
dialogErrors.value = null
const data = await apiRequest<{ success: boolean; message: string }>('/update_profile',
{
headers: {
'auth-key': token || ''
@ -144,6 +152,7 @@ async function save() {
} else {
dialogType.value = 'error'
dialogMessage.value = data.message || 'Hiba történt'
dialogErrors.value = data?.errors
}
showDialog.value = true
}

View File

@ -2,7 +2,7 @@
<div>
<div class="flex flex-col p-3">
<DatePicker inline :min-date="rent.auto_felvetel_datum" v-model="rent.auto_leadas_datum" />
<DatePicker inline :min-date="minDate" v-model="selectedDate" />
</div>
<div class="flex flex-col p-3">
@ -21,16 +21,37 @@ definePageMeta({
rentStep: 3,
title: 'Autóbérlés vége'
})
// Helyi Date objektum a DatePicker-hez
const selectedDate = ref<Date | null>(rent.value.auto_leadas_datum ? new Date(rent.value.auto_leadas_datum) : null)
// Min dátum a felvételi dátumból
const minDate = computed(() => {
return rent.value.auto_felvetel_datum ? new Date(rent.value.auto_felvetel_datum) : new Date()
})
// Ha változik a kiválasztott dátum, szöveggé alakítjuk (YYYY-MM-DD)
watch(selectedDate, (newDate) => {
if (newDate) {
const year = newDate.getFullYear()
const month = String(newDate.getMonth() + 1).padStart(2, '0')
const day = String(newDate.getDate()).padStart(2, '0')
rent.value.auto_leadas_datum = `${year}-${month}-${day}`
} else {
rent.value.auto_leadas_datum = null
}
})
function next() {
navigateTo('/rent/place-to')
}
const rentDays = computed(() => {
// Dátum objektumok létrehozása
const kezdoDatumObj = rent.auto_felvetel_datum;
const vegDatumObj = rent.auto_leadas_datum;
// Dátum stringek összehasonlítása
const kezdoDatumObj = new Date(rent.value.auto_felvetel_datum);
const vegDatumObj = new Date(rent.value.auto_leadas_datum);
// A két dátum közötti különbség millimásodpercben
const kulonbsegMs = vegDatumObj - kezdoDatumObj;
const kulonbsegMs = vegDatumObj.getTime() - kezdoDatumObj.getTime();
// Átváltás napokba (egy nap 86400000 millimásodperc)
const napok = Math.floor(kulonbsegMs / 86400000);

View File

@ -1,7 +1,7 @@
<template>
<div>
<div class="flex flex-col p-3">
<DatePicker inline :min-date="(new Date())" v-model="rent.auto_felvetel_datum"/>
<DatePicker inline :min-date="(new Date())" v-model="selectedDate"/>
</div>
<div class="flex flex-col p-3">
@ -20,6 +20,22 @@ definePageMeta({
rentStep: 1,
title:'Autóbérlés kezdete'
})
// Helyi Date objektum a DatePicker-hez
const selectedDate = ref<Date | null>(rent.value.auto_felvetel_datum ? new Date(rent.value.auto_felvetel_datum) : null)
// Ha változik a kiválasztott dátum, szöveggé alakítjuk (YYYY-MM-DD)
watch(selectedDate, (newDate) => {
if (newDate) {
const year = newDate.getFullYear()
const month = String(newDate.getMonth() + 1).padStart(2, '0')
const day = String(newDate.getDate()).padStart(2, '0')
rent.value.auto_felvetel_datum = `${year}-${month}-${day}`
} else {
rent.value.auto_felvetel_datum = null
}
})
function next() {
navigateTo('/rent/place-from')
}

View File

@ -1,14 +1,14 @@
<template>
<div class="p-3">
<div class="p-card border-t border-t-4 border-primary p-4">
<div><b>Név: </b>{{ user.nev }}</div>
<div><b>E-mail: </b>{{ user.email }}</div>
<div><b>Telefon: </b>{{ user.telefon }}</div>
<div><b>Anyja neve: </b>{{ user.anyja_neve }}</div>
<div><b>Születési hely: </b>{{ user.szuletesi_hely }}</div>
<div><b>Születési idő: </b>{{ user.szuletesi_ido }}</div>
<div><b>Állampolgárság: </b>{{ user.nemzetiseg }}</div>
<div class="text-sm"><b>Személyi igazolvány / Útlevél száma: </b><br>{{ user.szigszam }}</div>
<div class="flex justify-between"><b>Név: </b>{{ user.nev }}</div>
<div class="flex justify-between"><b>E-mail: </b>{{ user.email }}</div>
<div class="flex justify-between"><b>Telefon: </b>{{ user.telefon }}</div>
<div class="flex justify-between"><b>Anyja neve: </b>{{ user.anyja_neve }}</div>
<div class="flex justify-between"><b>Születési hely: </b>{{ user.szuletesi_hely }}</div>
<div class="flex justify-between"><b>Születési idő: </b>{{ user.szuletesi_ido }}</div>
<div class="flex justify-between"><b>Állampolgárság: </b>{{ user.nemzetiseg }}</div>
<div class="text-sm mt-3"><b>Személyi igazolvány / Útlevél száma: </b><br>{{ user.szigszam }}</div>
<div class="text-sm"><b>Jogosítvány száma: </b><br>{{ user.jogositvany_szama }}</div>
<div class="text-sm"><b>Lakcím: </b><br>{{ user.lakcim }}</div>
<div class="text-sm"><b>Tartózkodási cím: </b><br>{{ user.tartozkodasicim }}</div>
@ -19,8 +19,8 @@
<li v-for="field in missingFields" :key="field.key">{{ field.label }}</li>
</ul>
</Message>
<Message v-else class="mt-2" severity="warn">Amennyiben adataidban változás történt, módosítsd a <i
class="pi pi-user mx-2"></i> profilodban.</Message>
<Message v-else class="mt-2 text-center" severity="warn">Amennyiben adataidban változás történt, módosítsd a <span class="text-nowrap"><i
class="pi pi-user mx-1"></i> profilodban</span>.</Message>
<div class="text-center">
<Button variant="link" @click="$router.push({ path: '/profile' })">Adatok módosítása</Button>
@ -33,13 +33,13 @@
}}</b></div>
<div class="flex items-baseline flex-row">
<div class="text-center p-2 w-full items-top">
<div class="text-xs">{{ useLocaleDateString(rent.auto_felvetel_datum) }}</div>
<div class="text-xs">{{ rent.auto_felvetel_datum }}</div>
<div class="text-2xl">{{ rent.auto_felvetel_idopont }}</div>
<div class="text-xs">{{ rent.auto_felvetel_hely?.name }}</div>
</div>
<div class="w-4"></div>
<div class="text-center p-2 w-full">
<div class="text-xs">{{ useLocaleDateString(rent.auto_leadas_datum) }}</div>
<div class="text-xs">{{ rent.auto_leadas_datum }}</div>
<div class="text-2xl">{{ rent.auto_leadas_idopont }}</div>
<div class="text-xs">{{ rent.auto_leadas_hely?.name }}</div>
</div>
@ -52,15 +52,20 @@
</div>
</div>
<div class="py-5">
<Button @click="$router.push({ path: '/rent/thanks' })" class="w-full" :disabled="isValid">Foglalás
<Button @click="sendRent()" class="w-full" :disabled="isValid">Foglalás
elküldése</Button>
</div>
<DevOnly>
<pre>{{ rent }}</pre>
<pre>{{ user }}</pre>
</DevOnly>
</div>
</template>
<script lang="ts" setup>
const { rent, user } = storeToRefs(useAuthStore())
const { config } = storeToRefs(useMyConfigStore())
const { apiRequest } = useApi()
const confirms = ref([])
const requiredFields = [
{ key: 'nev', label: 'Név' },
@ -94,6 +99,25 @@ const isValid = computed(() => {
if (config.value?.rent.confirms.length > confirms.value?.length) return true
return false
})
async function sendRent(){
console.log(rent.value)
const data = await apiRequest('/rent', {
method: 'POST',
body:{
user:user.value,
rent:rent.value
}
})
if(data?.success){
}
if(data?.error){
}
}
</script>
<style></style>

View File

@ -3,21 +3,25 @@
<div class="bg-gray-500 bg-opacity-20 rounded-full w-24 h-24 flex items-center justify-center mx-auto">
<Icon name="ph:calendar-check" size="72" class="text-green-600 dark:text-green-400" />
</div>
<div class="text-center font-bold text-green-600 dark:text-green-400 my-3" v-html="config?.rent.thanks_message.title"></div>
<div class="text-center font-bold text-green-600 dark:text-green-400 my-3"
v-html="config?.rent.thanks_message.title"></div>
<div class="text-center text-sm" v-html="config?.rent.thanks_message.content"></div>
<Button icon="i-ph-check-circle" class="my-3 w-full" @click="$router.push({path:'/'})">Rendben</Button>
<Button icon="i-ph-check-circle" class="my-3 w-full" @click="$router.push({ path: '/' })">Rendben</Button>
</div>
</template>
<script lang="ts" setup>
const {rent} = storeToRefs(useAuthStore())
const {config} = storeToRefs(useMyConfigStore())
const { rent } = storeToRefs(useAuthStore())
const { config } = storeToRefs(useMyConfigStore())
definePageMeta({
rentStep: 8,
title:''
title: ''
})
onMounted(() => {
// rent.value = null
})
</script>
<style>
</style>
<style></style>

View File

@ -4,14 +4,49 @@ import { SplashScreen } from '@capacitor/splash-screen'
import { Haptics, ImpactStyle } from '@capacitor/haptics'
import { Capacitor } from '@capacitor/core'
export default defineNuxtPlugin((nuxtApp) => {
export default defineNuxtPlugin(async (nuxtApp) => {
const siteData = ref()
const categoriesStore = useCategoriesStore()
const placeStore = useMyPlacesStore()
const authStore = useAuthStore()
const configStore = useMyConfigStore()
const { loadToken, getToken } = useAuthToken()
const { apiFetch } = useApi()
const token = await loadToken()
console.log(token)
const { data } = await apiFetch('/init',
{
headers: {
'auth-key': token || ''
}
}
)
if (data.value?.user) {
authStore.user = data.value.user
}
if (data.value?.config) {
configStore.config = data.value.config
}
if (data.value?.states) {
configStore.states = data.value.states
}
if (data.value?.categories) {
categoriesStore.categories = data.value.categories
placeStore.places = data.value.places
}
// Csak natív platformon fut
if (!Capacitor.isNativePlatform()) {
return
}
const router = useRouter()
// Android hardware back button kezelése
App.addListener('backButton', async ({ canGoBack }) => {
// Ha van history, navigáljunk vissza

View File

@ -35,6 +35,9 @@ importers:
'@capacitor/status-bar':
specifier: ^8.0.0
version: 8.0.0(@capacitor/core@8.0.0)
'@pinia-plugin-persistedstate/nuxt':
specifier: ^1.2.1
version: 1.2.1(@pinia/nuxt@0.9.0(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3))))(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)))
primeicons:
specifier: ^7.0.0
version: 7.0.0
@ -1435,6 +1438,12 @@ packages:
resolution: {integrity: sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==}
engines: {node: '>= 10.0.0'}
'@pinia-plugin-persistedstate/nuxt@1.2.1':
resolution: {integrity: sha512-q8s+4aQW/AjBMyeqLL48/qzBR5lcgnvvf1525ovNuKf6Wl9CsoLjPKh/5X8vNoKGwSow4gP7lVmdYPQRypgjgg==}
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
peerDependencies:
'@pinia/nuxt': ^0.5.0
'@pinia/nuxt@0.9.0':
resolution: {integrity: sha512-2yeRo7LeyCF68AbNeL3xu2h6uw0617RkcsYxmA8DJM0R0PMdz5wQHnc44KeENQxR/Mrq8T910XVT6buosqsjBQ==}
peerDependencies:
@ -4178,6 +4187,20 @@ packages:
resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==}
engines: {node: '>=4'}
pinia-plugin-persistedstate@4.7.1:
resolution: {integrity: sha512-WHOqh2esDlR3eAaknPbqXrkkj0D24h8shrDPqysgCFR6ghqP/fpFfJmMPJp0gETHsvrh9YNNg6dQfo2OEtDnIQ==}
peerDependencies:
'@nuxt/kit': '>=3.0.0'
'@pinia/nuxt': '>=0.10.0'
pinia: '>=3.0.0'
peerDependenciesMeta:
'@nuxt/kit':
optional: true
'@pinia/nuxt':
optional: true
pinia:
optional: true
pinia@2.3.1:
resolution: {integrity: sha512-khUlZSwt9xXCaTbbxFYBKDc/bWAGWJjOgvxETwkTN7KRm66EeT1ZdZj6i2ceh9sP2Pzqsbc704r2yngBrxBVug==}
peerDependencies:
@ -7539,6 +7562,16 @@ snapshots:
'@parcel/watcher-win32-ia32': 2.5.1
'@parcel/watcher-win32-x64': 2.5.1
'@pinia-plugin-persistedstate/nuxt@1.2.1(@pinia/nuxt@0.9.0(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3))))(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)))':
dependencies:
'@nuxt/kit': 3.20.2(magicast@0.5.1)
'@pinia/nuxt': 0.9.0(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)))
defu: 6.1.4
pinia-plugin-persistedstate: 4.7.1(@nuxt/kit@3.20.2(magicast@0.5.1))(@pinia/nuxt@0.9.0(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3))))(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)))
transitivePeerDependencies:
- magicast
- pinia
'@pinia/nuxt@0.9.0(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)))':
dependencies:
'@nuxt/kit': 3.20.2(magicast@0.5.1)
@ -10743,6 +10776,14 @@ snapshots:
pify@3.0.0: {}
pinia-plugin-persistedstate@4.7.1(@nuxt/kit@3.20.2(magicast@0.5.1))(@pinia/nuxt@0.9.0(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3))))(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3))):
dependencies:
defu: 6.1.4
optionalDependencies:
'@nuxt/kit': 3.20.2(magicast@0.5.1)
'@pinia/nuxt': 0.9.0(magicast@0.5.1)(pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)))
pinia: 2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3))
pinia@2.3.1(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)):
dependencies:
'@vue/devtools-api': 6.6.4

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 112 KiB

BIN
public/splash-dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

BIN
public/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

View File

@ -2,13 +2,23 @@ import { defineStore } from 'pinia'
export const useAuthStore = defineStore({
id: 'AuthStore',
state: () => ({ user: null, rentals: null, rent: {} }),
state: () => ({ user: null, rentals: null, rent: {}, token: null }),
persist: {
storage: localStorage,
},
getters:{
token(){
return this.token
}
},
actions: {
async getData() {
const { getToken } = useAuthToken()
const { apiFetch } = useApi()
const token = getToken()
if (token) {
const { data } = await useFetch('https://olcsoberauto.hu/rest/me',
this.token = token
const { data } = await apiFetch('/me',
{
headers: {
'auth-key': token
@ -27,6 +37,7 @@ export const useAuthStore = defineStore({
await clearToken()
this.user = null
this.rentals = null
this.token = null
this.rent = {}
navigateTo('/login')
}