chore(maintenance): dep update + url update
This commit is contained in:
parent
18aa35b2bd
commit
9823706462
7 changed files with 2331 additions and 46 deletions
48
app.vue
48
app.vue
|
@ -1,35 +1,35 @@
|
|||
<script setup>
|
||||
// ITEM FETCHING //
|
||||
// set initial sort order
|
||||
const sortVariable = ref(["reserved", "date_created"]);
|
||||
const reservedVariable = ref(true);
|
||||
const sortVariable = ref(['reserved', 'date_created'])
|
||||
const reservedVariable = ref(true)
|
||||
// fetch data
|
||||
const { homepage } = await GqlGetHomepage();
|
||||
const { data, refresh } = await useAsyncData("gifts", () =>
|
||||
const { homepage } = await GqlGetHomepage()
|
||||
const { data, refresh } = await useAsyncData('gifts', () =>
|
||||
GqlGifts({ sort: sortVariable.value })
|
||||
);
|
||||
)
|
||||
// update sort param
|
||||
function sortList(param) {
|
||||
sortVariable.value = param;
|
||||
sortVariable.value = param
|
||||
// refetch query (expose token or access pubic data)
|
||||
refresh();
|
||||
refresh()
|
||||
}
|
||||
// filter out already reserved items
|
||||
const filteredList = computed(() => {
|
||||
const list = data;
|
||||
return list;
|
||||
});
|
||||
const list = data
|
||||
return list
|
||||
})
|
||||
|
||||
// CHANGE DISPLAY //
|
||||
const listDisplay = ref(false);
|
||||
const listDisplay = ref(false)
|
||||
function toggleDisplay() {
|
||||
listDisplay.value = !listDisplay.value;
|
||||
listDisplay.value = !listDisplay.value
|
||||
}
|
||||
|
||||
// ITEM RESERVATION //
|
||||
// no error to start
|
||||
const errorStatus = ref(false);
|
||||
const statusMessage = ref("");
|
||||
const errorStatus = ref(false)
|
||||
const statusMessage = ref('')
|
||||
// update the chosen item's reservation status
|
||||
async function runMutation(payload) {
|
||||
try {
|
||||
|
@ -37,23 +37,23 @@ async function runMutation(payload) {
|
|||
id: payload.id,
|
||||
reserved: payload.reserve,
|
||||
name: payload.name,
|
||||
});
|
||||
})
|
||||
} catch (error) {
|
||||
// if error, set the status to true
|
||||
console.log("---ERREUR---", error);
|
||||
errorStatus.value = true;
|
||||
console.log('---ERREUR---', error)
|
||||
errorStatus.value = true
|
||||
} finally {
|
||||
if (errorStatus.value) {
|
||||
// if error is true, show an error notice
|
||||
statusMessage.value = "Une erreur est survenue… ¯\\_(ツ)_/¯";
|
||||
statusMessage.value = 'Une erreur est survenue… ¯\\_(ツ)_/¯'
|
||||
// cleanup the error status
|
||||
errorStatus.value = false;
|
||||
errorStatus.value = false
|
||||
} else {
|
||||
// if all is well, show a success notice
|
||||
statusMessage.value = `C'est noté merci beaucoup ${payload.name} 🥰`;
|
||||
statusMessage.value = `C'est noté merci beaucoup ${payload.name} 🥰`
|
||||
setTimeout(() => {
|
||||
refresh();
|
||||
}, 3500);
|
||||
refresh()
|
||||
}, 3500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ async function runMutation(payload) {
|
|||
<h1>Liste de naissance</h1>
|
||||
<section class="intro sidebar--reverse" data-direction="rtl">
|
||||
<article v-html="homepage.content" class="editorial" />
|
||||
<div>
|
||||
<div v-if="homepage.illustration">
|
||||
<NuxtPicture
|
||||
:src="`https://admin.habillerbebe.liliste.fr/assets/${homepage.illustration.id}.`"
|
||||
:src="`https://admin.liliste.fr/assets/${homepage.illustration.id}.`"
|
||||
width="900"
|
||||
height="563"
|
||||
class="intro__image"
|
||||
|
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -1,30 +1,30 @@
|
|||
<script setup>
|
||||
const props = defineProps({
|
||||
item: { type: Object, default: () => {} },
|
||||
statusMessage: { type: String, default: "" },
|
||||
});
|
||||
statusMessage: { type: String, default: '' },
|
||||
})
|
||||
|
||||
let showDetails = ref(true);
|
||||
let showDetails = ref(true)
|
||||
|
||||
const formError = ref("");
|
||||
const isFormVisible = ref(false);
|
||||
const formError = ref('')
|
||||
const isFormVisible = ref(false)
|
||||
function showReservation() {
|
||||
isFormVisible.value = !isFormVisible.value;
|
||||
isFormVisible.value = !isFormVisible.value
|
||||
}
|
||||
|
||||
const reserved = ref(false);
|
||||
const fromName = ref("");
|
||||
const emit = defineEmits(["reserved"]);
|
||||
const reserved = ref(false)
|
||||
const fromName = ref('')
|
||||
const emit = defineEmits(['reserved'])
|
||||
|
||||
const sendReservation = (id, reserve, name) => {
|
||||
console.log(fromName);
|
||||
console.log(fromName)
|
||||
if (reserved.value && fromName.value.length > 1) {
|
||||
emit("reserved", { id, reserve, name });
|
||||
formError.value = "";
|
||||
emit('reserved', { id, reserve, name })
|
||||
formError.value = ''
|
||||
} else {
|
||||
formError.value = "Veuillez remplir le formulaire";
|
||||
formError.value = 'Veuillez remplir le formulaire'
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -37,7 +37,7 @@ const sendReservation = (id, reserve, name) => {
|
|||
<p v-if="!item.reserved">🎉 Ce cadeau est disponible !</p>
|
||||
<p v-else>
|
||||
Ce cadeau est déjà réservé par
|
||||
<span class="from-name">{{ item.from || "¯\_(ツ)_/¯" }}</span> 🤗
|
||||
<span class="from-name">{{ item.from || '¯\_(ツ)_/¯' }}</span> 🤗
|
||||
</p>
|
||||
</div>
|
||||
<p v-if="!item.reserved && item.prix" class="h2 gift__price">
|
||||
|
@ -107,7 +107,7 @@ const sendReservation = (id, reserve, name) => {
|
|||
v-if="item.photo"
|
||||
format="avif,webp"
|
||||
class="gift__photo"
|
||||
:src="`https://admin.habillerbebe.liliste.fr/assets/${item.photo.id}?width=200&height=200&fit=inside`"
|
||||
:src="`https://admin.liliste.fr/assets/${item.photo.id}?width=200&height=200&fit=inside`"
|
||||
loading="lazy"
|
||||
width="200"
|
||||
height="200"
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
"devDependencies": {
|
||||
"@nuxt/devtools": "latest",
|
||||
"@nuxt/image": "npm:@nuxt/image-nightly@latest",
|
||||
"nuxt": "^3.10.3",
|
||||
"nuxt": "^3.17.6",
|
||||
"postcss-import-ext-glob": "^2.1.1",
|
||||
"vue": "^3.4.21",
|
||||
"vue-router": "^4.3.0"
|
||||
"vue": "^3.5.17",
|
||||
"vue-router": "^4.5.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt-graphql-client": "^0.2.33"
|
||||
"nuxt-graphql-client": "^0.2.46"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
query gifts($sort: [String!]) {
|
||||
gifts(filter: { status: { _eq: "published" } }, sort: $sort) {
|
||||
gifts(
|
||||
filter: {
|
||||
_and: [
|
||||
{ status: { _eq: "published" } }
|
||||
{ user_created: { _eq: "b6ea47ff-718b-4d3f-a712-0623a7cb51b7" } }
|
||||
]
|
||||
}
|
||||
sort: $sort
|
||||
) {
|
||||
status
|
||||
user_created
|
||||
id
|
||||
name
|
||||
url
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
query getHomepage {
|
||||
homepage {
|
||||
homepage: homepage_by_id(id: 1) {
|
||||
date_updated
|
||||
content
|
||||
illustration {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue