Skip to content

Commit

Permalink
fix contact form
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoRCD committed Nov 12, 2024
1 parent 84b30e0 commit 21682e9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ FROM oven/bun:latest AS build
ARG TURBO_TEAM
ARG TURBO_TOKEN

Check warning on line 5 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "TURBO_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ARG NUXT_PRIVATE_GITHUB_TOKEN

Check warning on line 6 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "NUXT_PRIVATE_GITHUB_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ARG NUXT_PUBLIC_STUDIO_TOKENS
ARG NUXT_PUBLIC_SITE_URL
ARG NUXT_PUBLIC_MEETING_LINK
ARG NUXT_PRIVATE_RESEND_API_KEY

Check warning on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "NUXT_PRIVATE_RESEND_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ARG NUXT_PRIVATE_NOTES_PASSWORD

Check warning on line 11 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "NUXT_PRIVATE_NOTES_PASSWORD") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

ENV TURBO_TEAM=$TURBO_TEAM
ENV TURBO_TOKEN=$TURBO_TOKEN

Check warning on line 14 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "TURBO_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV NUXT_PRIVATE_GITHUB_TOKEN=$NUXT_PRIVATE_GITHUB_TOKEN

Check warning on line 15 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "NUXT_PRIVATE_GITHUB_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV NUXT_PUBLIC_STUDIO_TOKENS=$NUXT_PUBLIC_STUDIO_TOKENS
ENV NUXT_PUBLIC_SITE_URL=$NUXT_PUBLIC_SITE_URL
ENV NUXT_PUBLIC_MEETING_LINK=$NUXT_PUBLIC_MEETING_LINK
ENV NUXT_PRIVATE_RESEND_API_KEY=$NUXT_PRIVATE_RESEND_API_KEY

Check warning on line 19 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "NUXT_PRIVATE_RESEND_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV NUXT_PRIVATE_NOTES_PASSWORD=$NUXT_PRIVATE_NOTES_PASSWORD

Check warning on line 20 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "NUXT_PRIVATE_NOTES_PASSWORD") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV NODE_ENV=production

WORKDIR /app
Expand Down
10 changes: 5 additions & 5 deletions app/components/content/ContactForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ const email = ref('')
const message = ref('')
const name = ref('')
const { status, error, refresh } = useFetch('/api/send', {
const { error, refresh } = useFetch('/api/send', {
method: 'POST',
body: { email, message, name },
watch: false,
immediate: false
})
const loading = ref(false)
async function submit() {
if (!email.value || !message.value) {
toast.error('Please fill in all required fields.')
return
}
loading.value = true
await refresh()
if (!error.value) {
email.value = ''
Expand All @@ -24,6 +26,7 @@ async function submit() {
} else {
toast.error('An error occurred while sending your message.')
}
loading.value = false
}
onMounted(() => {
Expand Down Expand Up @@ -73,10 +76,7 @@ onMounted(() => {
>
<span class="flex items-center justify-center gap-2">
Send
<i
v-if="status === 'pending'"
class="i-lucide-loader size-4 animate-spin text-inverted"
/>
<MIcon v-if="loading" name="lucide:loader" class="text-inverted animate-spin" />
</span>
</button>
</form>
Expand Down
Binary file modified bun.lockb
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default defineNuxtConfig({
},

nitro: {
preset: process.env.NITRO_PRESET || 'bun',
preset: process.env.NITRO_PRESET || 'node-server',
prerender: {
crawlLinks: true,
routes: ['/', '/works', '/about', '/writing', '/sitemap.xml'],
Expand Down

0 comments on commit 21682e9

Please sign in to comment.