Added new contact page by turukawa · Pull Request #20 · whythawk/full-stack-fastapi-postgresql · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import Any

from fastapi import APIRouter

from app import schemas
from app.utilities import send_web_contact_email
from app.schemas import EmailContent

router = APIRouter()


@router.post("/contact", response_model=schemas.Msg, status_code=201)
def send_email(*, data: EmailContent) -> Any:
"""
Standard app contact us.
"""
send_web_contact_email(data=data)
return {"msg": "Web contact email sent"}
3 changes: 2 additions & 1 deletion {{cookiecutter.project_slug}}/frontend/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { apiCore } from "./core"
import { apiAuth } from "./auth"
import { apiService } from "./services"

export { apiCore, apiAuth }
export { apiCore, apiAuth, apiService }
14 changes: 14 additions & 0 deletions {{cookiecutter.project_slug}}/frontend/api/services.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ISendEmail, IMsg } from "@/interfaces"
import { apiCore } from "./core"

export const apiService = {
// USER CONTACT MESSAGE
async postEmailContact(data: ISendEmail) {
return await useFetch<IMsg>(`${apiCore.url()}/service/contact`,
{
method: "POST",
body: data,
}
)
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const footerNavigation = {
{ name: "About", to: "/about" },
{ name: "Authentication", to: "/authentication" },
{ name: "Blog", to: "/blog" },
{ name: "Contact", to: "/contact" },
],
social: [
{
Expand Down
125 changes: 125 additions & 0 deletions {{cookiecutter.project_slug}}/frontend/pages/contact.vue