Skip to content

Commit

Permalink
Fix post errors (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmichaels authored Jun 30, 2024
1 parent c30b3af commit 7c53f29
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions assets/view/layout/base.templ
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ templ Base() {
<script src={ theme } defer></script>
<script src={ bundle } defer></script>
<script src={ localStorage } defer></script>
<script src={ htmx } defer></script>
<link rel="icon" type="image/x-icon" href="/static/icons/favicon.ico"/>
if plausible != "" {
@PlausibleScript(plausible)
Expand All @@ -39,7 +38,7 @@ templ Base() {
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
{ children... }
</main>
@Footer()
@Footer()
</body>
</html>
}
2 changes: 1 addition & 1 deletion assets/view/layout/footer.templ
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ templ Footer() {
</div>
<div x-data>
<p class="mt-8 text-center text-base text-gray-400">
&copy;<span x-text=" new Date().getFullYear() " ></span> { appName }, All rights reserved.
&copy;<span x-text=" new Date().getFullYear() "></span> { appName }, All rights reserved.
</p>
</div>
</div>
Expand Down
11 changes: 6 additions & 5 deletions assets/view/pages/home.templ
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"github.com/danielmichaels/shortlink-go/internal/config"
)

var title = config.AppConfig().Names.AppName
var (
title = config.AppConfig().Names.AppName
)

templ Home() {
@layout.Base() {
Expand Down Expand Up @@ -217,9 +219,8 @@ templ LinksSection() {

templ SubmitFormScript() {
<script>
// todo: remove and use HTMX
const FORM_URL = "{{ .AppUrl }}/v1/links"
function shortenForm() {
const formURL = window.location.origin
return {
formData: {
link: ""
Expand All @@ -234,7 +235,7 @@ templ SubmitFormScript() {
this.formLoading = false;
this.buttonText = "Submitting..."
this.formError = false
fetch(FORM_URL, {
fetch(formURL + "/v1/links", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -249,7 +250,7 @@ templ SubmitFormScript() {
throw new Error("error")
})
.then((resp) => {
console.log(resp)
console.debug(resp)
this.formData.link = "";
this.formMessage = "Link successfully saved"
appendLocalStorageHashes(resp)
Expand Down

0 comments on commit 7c53f29

Please sign in to comment.