mirror of
https://github.com/ArthurDanjou/website-old.git
synced 2026-01-14 12:14:42 +01:00
Working
This commit is contained in:
@@ -36,7 +36,7 @@ const ssr = true
|
||||
|
||||
const proxy = {
|
||||
'/api': {
|
||||
target: "https://api.arthurdanjou.fr",
|
||||
target: 'https://api.arthurdanjou.fr',
|
||||
pathRewrite: { "^/api": "" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const publicRuntimeConfig = {
|
||||
|
||||
}
|
||||
|
||||
const privateRuntimeConfig = {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<section class="p-6 border border-indigo-600 dark:border-indigo-700 rounded-lg text-justify">
|
||||
<h1 class="text-black font-bold dark:text-white text-2xl">{{ $t('guestbook.signin') }}</h1>
|
||||
<h3 class="text-gray-500 dark:text-gray-400">{{ $t('guestbook.share') }}</h3>
|
||||
<div v-if="!success && !error" class="flex space-x-4 my-3">
|
||||
<div v-if="!loginRef" class="flex space-x-4 my-3">
|
||||
<div @click="login('google')" class="icon-parent flex justify-center items-center p-2 border border-black dark:border-white duration-300 cursor-pointer">
|
||||
<GoogleIcon />
|
||||
</div>
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="my-3">
|
||||
<form v-if="!success" class="relative">
|
||||
<form class="relative">
|
||||
<input
|
||||
required
|
||||
type="text"
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-sm text-gray-700 dark:text-gray-300">{{ $t('guestbook.infos') }}</p>
|
||||
<p class="text-sm text-gray-400 dark:text-gray-600">{{ $t('guestbook.infos') }}</p>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -54,9 +54,18 @@ export default defineComponent({
|
||||
setup() {
|
||||
const { $axios, $sentry, app } = useContext()
|
||||
|
||||
const loginRef = ref(false)
|
||||
const login = async (driver: 'github' | 'google' | 'twitter') => {
|
||||
const response = await $axios.get(`/api/auth/${driver}`)
|
||||
const response = await $axios.get(`/api/auth/${driver}`, {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': 'https://arthurdanjou.fr',
|
||||
'Accept': '*/*',
|
||||
'Origin': 'https://arthurdanjou.fr',
|
||||
'host': 'https://arthurdanjou.fr'
|
||||
}
|
||||
})
|
||||
if (response.status === 200) {
|
||||
loginRef.value = true
|
||||
await hasAlreadySignMessage(response.data.user.id)
|
||||
} else {
|
||||
$sentry.captureEvent(response.data)
|
||||
@@ -70,7 +79,8 @@ export default defineComponent({
|
||||
|
||||
const handleForm = async () => {
|
||||
const response = await $axios.post('/api/guestbook', {
|
||||
message: form.value.message
|
||||
message: form.value.message,
|
||||
email: 'contact@arthurdanjou.fr'
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${process.env.API_TOKEN}`
|
||||
@@ -96,7 +106,7 @@ export default defineComponent({
|
||||
}
|
||||
})
|
||||
if (response.status === 200) {
|
||||
switch (response.data.data) {
|
||||
switch (response.data.signed) {
|
||||
case 0:
|
||||
alreadySent.value = false
|
||||
break
|
||||
@@ -115,6 +125,7 @@ export default defineComponent({
|
||||
success,
|
||||
error,
|
||||
alreadySent,
|
||||
loginRef,
|
||||
handleForm,
|
||||
hasAlreadySignMessage
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<div class="my-6">
|
||||
<div class="text-justify leading-6">
|
||||
<div class="text-justify leading-6 text-black dark:text-white">
|
||||
{{ message }}
|
||||
</div>
|
||||
<div class="flex mt-3">
|
||||
<div class="text-gray-600">
|
||||
<div class="text-gray-600 dark:text-gray-300">
|
||||
{{ author }}
|
||||
</div>
|
||||
<div class="text-gray-200 px-3">/</div>
|
||||
<div class="text-gray-400 lining-nums">
|
||||
<div class="text-gray-200 px-3 dark:text-gray-700">/</div>
|
||||
<div class="text-gray-400 dark:text-gray-500 lining-nums">
|
||||
{{ formatDateAndTime }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<main class="error w-full px-5 xl:px-64">
|
||||
<div class="mt-24 w-full h-full flex items-center justify-center">
|
||||
<div class="flex flex-col items-center md:mb-20">
|
||||
<div class="flex">
|
||||
<div class="flex items-center">
|
||||
<div class="h-16 w-16 mr-4">
|
||||
<ErrorIcon class="w-full h-full"/>
|
||||
</div>
|
||||
<div class="mb-12 lining-nums">
|
||||
<div class="lining-nums">
|
||||
<div class="mb-2">
|
||||
<p v-if="error.statusCode === 404" class="text-3xl md:text-6xl dark:text-white font-bold">
|
||||
{{ $t('error.error').toUpperCase() }} 404
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-4 w-full text-center">
|
||||
<div class="mt-12 mb-4 w-full text-center">
|
||||
<div class="home-btn" @click="next">
|
||||
<div class="cursor-pointer w-full py-4 px-4 md:py-4 md:px-4 font-bold hover:(bg-indigo-600 text-white) duration-500 rounded">
|
||||
<BackSpaceIcon class="arrow-img text-xl"/>
|
||||
|
||||
@@ -64,7 +64,7 @@ export default defineComponent({
|
||||
const subscribersCount = ref(0)
|
||||
|
||||
useAsync(() => {
|
||||
$axios.get('/subscribers', {
|
||||
$axios.get('/api/subscribers', {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${process.env.API_TOKEN}`,
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export default defineComponent({
|
||||
const form = ref<NewsletterForm>({} as NewsletterForm)
|
||||
|
||||
const handleForm = () => {
|
||||
$axios.post('/subscribers', {
|
||||
$axios.post('/api/subscribers', {
|
||||
email: form.value.email
|
||||
}, {
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user