newsletter fix attempt, connect form messages

This commit is contained in:
bniwredyc 2023-05-12 15:59:40 +02:00
parent bd6e014cdf
commit f5062162b2
2 changed files with 39 additions and 35 deletions

View File

@ -3,14 +3,14 @@ const Mailgun = require('mailgun.js')
const mailgun = new Mailgun(formData)
const { MAILGUN_API_KEY, MAILGUN_DOMAIN } = process.env
const { MAILGUN_API_KEY } = process.env
const mg = mailgun.client({ username: 'discoursio', key: MAILGUN_API_KEY })
export default async (req, res) => {
const { email } = req.body
try {
const response = await mg.lists.members.createMember(MAILGUN_DOMAIN, {
const response = await mg.lists.members.createMember('robot@discours.io', {
address: email,
subscribed: true,
upsert: 'yes'

View File

@ -1,5 +1,5 @@
import { PageLayout } from '../components/_shared/PageLayout'
import { createSignal } from 'solid-js'
import { createSignal, Show } from 'solid-js'
export const ConnectPage = () => {
const [state, setState] = createSignal<'initial' | 'loading' | 'success' | 'error'>('initial')
@ -41,13 +41,14 @@ export const ConnectPage = () => {
<article class="wide-container container--static-page">
<div class="row">
<div class="col-sm-20 col-md-16 col-lg-14 col-xl-12 offset-md-5">
<Show when={state() === 'loading' || state() === 'initial'}>
<h1>
<span class="wrapped">Предложить идею</span>
</h1>
<p>
Хотите что-то предложить, обсудить или посоветовать? Поделиться темой или идеей? Напишите нам
скорее! Если укажете свою почту, мы&nbsp;обязательно ответим.
Хотите что-то предложить, обсудить или посоветовать? Поделиться темой или идеей? Напишите
нам скорее! Если укажете свою почту, мы&nbsp;обязательно ответим.
</p>
<form onSubmit={handleFormSubmit} ref={(el) => (formRef.current = el)}>
@ -71,10 +72,13 @@ export const ConnectPage = () => {
<textarea name="message" placeholder="Текст сообщения" />
<label for="message">Текст сообщения</label>
</div>
<button class="button" disabled={state() !== 'initial'} type="submit">
<button class="button" disabled={state() === 'loading'} type="submit">
Отправить письмо
</button>
</form>
</Show>
<Show when={state() === 'error'}>Произошла ошибка</Show>
<Show when={state() === 'success'}>Спасибо</Show>
</div>
</div>
</article>