Dashboard fix
Mostmár működik a menüválasztó, minimális API Endpointokat n
This commit is contained in:
26
src/App.vue
26
src/App.vue
@@ -27,25 +27,25 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Dashboard oldal nézet -->
|
<!-- Dashboard oldal nézet -->
|
||||||
<div v-else-if="pageStatus=='contacts'" class="flex flex-row w-full h-full bg-red-300">
|
<div v-else-if="pageStatus=='contacts' || pageStatus=='admin'" class="flex flex-row w-full h-full bg-red-300">
|
||||||
<!-- Menü -->
|
<!-- Menü -->
|
||||||
<div class="flex flex-col w-1/6 h-full bg-neutral-400 py-10 px-3 space-y-3">
|
<div class="flex flex-col w-1/6 h-full bg-neutral-400 py-10 px-3 space-y-3">
|
||||||
<div class="flex flex-row h-fit w-full border-dashed border-2 border-neutral-300 p-1 rounded-lg justify-between">
|
<div class="flex flex-row h-fit w-full border-dashed border-2 border-neutral-300 p-1 rounded-lg justify-between" @click="switchContacts">
|
||||||
<div class="flex h-min w-fit ">Telefonkönyv</div>
|
<div class="flex h-min w-fit ">Telefonkönyv</div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex size-6">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex size-6">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.25 9.75v-4.5m0 4.5h4.5m-4.5 0 6-6m-3 18c-8.284 0-15-6.716-15-15V4.5A2.25 2.25 0 0 1 4.5 2.25h1.372c.516 0 .966.351 1.091.852l1.106 4.423c.11 .44-.054.902-.417 1.173l-1.293.97a1.062 1.062 0 0 0-.38 1.21 12.035 12.035 0 0 0 7.143 7.143c.441.162.928-.004 1.21-.38l.97-1.293a1.125 1.125 0 0 1 1.173-.417l4.423 1.106c.5.125.852.575.852 1.091V19.5a2.25 2.25 0 0 1-2.25 2.25h-2.25Z" />
|
<path stroke-linecap="round" stroke-linejoin="round" d="M14.25 9.75v-4.5m0 4.5h4.5m-4.5 0 6-6m-3 18c-8.284 0-15-6.716-15-15V4.5A2.25 2.25 0 0 1 4.5 2.25h1.372c.516 0 .966.351 1.091.852l1.106 4.423c.11 .44-.054.902-.417 1.173l-1.293.97a1.062 1.062 0 0 0-.38 1.21 12.035 12.035 0 0 0 7.143 7.143c.441.162.928-.004 1.21-.38l.97-1.293a1.125 1.125 0 0 1 1.173-.417l4.423 1.106c.5.125.852.575.852 1.091V19.5a2.25 2.25 0 0 1-2.25 2.25h-2.25Z" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row h-fit w-full border-dashed border-2 border-neutral-300 p-1 rounded-lg justify-between opacity-60">
|
<div v-if="userAdmin" class="flex flex-row h-fit w-full border-dashed border-2 border-neutral-300 p-1 rounded-lg justify-between" @click="switchAdmin">
|
||||||
<div class="flex h-min w-fit ">Admin</div>
|
<div class="flex h-min w-fit ">Admin</div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex size-6">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex size-6">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" />
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row h-fit w-full border-dashed border-2 border-neutral-300 p-1 rounded-lg justify-between">
|
<div class="flex flex-row h-fit w-full border-dashed border-2 border-neutral-300 p-1 rounded-lg justify-between" @click="logout">
|
||||||
<button class="flex h-min w-fit" @click="logout">Kijelentkezés</button>
|
<button class="flex h-min w-fit">Kijelentkezés</button>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex size-6">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex size-6">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M5.636 5.636a9 9 0 1 0 12.728 0M12 3v9" />
|
<path stroke-linecap="round" stroke-linejoin="round" d="M5.636 5.636a9 9 0 1 0 12.728 0M12 3v9" />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<hr class="flex border-2 border-black ml-20 mb-6">
|
<hr class="flex border-2 border-black ml-20 mb-6">
|
||||||
|
|
||||||
<!-- Contents -->
|
<!-- Contents -->
|
||||||
<div class="flex flex-col bg-neutral-50 mx-20 py-5 px-2 h-full">
|
<div v-if="pageStatus == 'contacts'" class="flex flex-col bg-neutral-50 mx-20 py-5 px-2 h-full">
|
||||||
|
|
||||||
<!-- TELEFONKÖNYV TÁBLA -->
|
<!-- TELEFONKÖNYV TÁBLA -->
|
||||||
<div class="flex flex-row items-center justify-between mb-3">
|
<div class="flex flex-row items-center justify-between mb-3">
|
||||||
@@ -156,9 +156,16 @@ const isLoadingContacts = ref(false)
|
|||||||
const editing = ref({ id: null, field: null })
|
const editing = ref({ id: null, field: null })
|
||||||
const editBuffer = ref({ id: null, name: "", phone: "", address: "", note: "" })
|
const editBuffer = ref({ id: null, name: "", phone: "", address: "", note: "" })
|
||||||
|
|
||||||
// ---- Segédfüggvény: GET body workaround ----
|
function switchAdmin(){
|
||||||
// Browserek nem küldenek body-t GET-tel, ezért POST-tal kérjük és
|
pageStatus.value = "admin"
|
||||||
// X-HTTP-Method-Override: GET fejlécet adunk hozzá.
|
menuSel.value = "Admin"
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchContacts(){
|
||||||
|
pageStatus.value = "contacts"
|
||||||
|
menuSel.value = "Telefonkönyv"
|
||||||
|
}
|
||||||
|
|
||||||
async function getWithBody(url, bodyObj) {
|
async function getWithBody(url, bodyObj) {
|
||||||
const res = await fetch(url, {
|
const res = await fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -168,7 +175,6 @@ async function getWithBody(url, bodyObj) {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- API hívások a /contacts-hoz ---
|
|
||||||
async function loadContacts() {
|
async function loadContacts() {
|
||||||
isLoadingContacts.value = true
|
isLoadingContacts.value = true
|
||||||
console.log(`${apiBase}/contacts`)
|
console.log(`${apiBase}/contacts`)
|
||||||
|
|||||||
Reference in New Issue
Block a user