Browse Source

fix passing isLoggedIn to header.html

master
Stephanie Gredell 1 year ago
parent
commit
60188b064c
  1. 5
      pages/welcome.go
  2. 4
      pages/wishlist.go
  3. 2
      templates/goals.html
  4. 4
      templates/header.html
  5. 2
      templates/index.html
  6. 14
      templates/welcome.html

5
pages/welcome.go

@ -1,12 +1,17 @@ @@ -1,12 +1,17 @@
package pages
import (
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"sponsorahacker/utils"
)
func Welcome(c *gin.Context) {
isLoggedIn := utils.CheckIfLoggedIn(c)
fmt.Println("isLoggedIn:", isLoggedIn)
c.HTML(http.StatusOK, "welcome.html", gin.H{
"title": "Sponsor A Hacker",
"isLoggedIn": isLoggedIn,
})
}

4
pages/wishlist.go

@ -3,10 +3,14 @@ package pages @@ -3,10 +3,14 @@ package pages
import (
"github.com/gin-gonic/gin"
"net/http"
"sponsorahacker/utils"
)
func Goals(c *gin.Context) {
isLoggedIn := utils.CheckIfLoggedIn(c)
c.HTML(http.StatusOK, "goals.html", gin.H{
"title": "Sponsor A Hacker",
"isLoggedIn": isLoggedIn,
})
}

2
templates/goals.html

@ -155,7 +155,7 @@ @@ -155,7 +155,7 @@
</style>
</head>
<body>
{{template "pageheader"}}
{{template "pageheader" . }}
<div class="wishlist-container">
<header class="wishlist-page-header">
<h1>Manage Your Goals</h1>

4
templates/header.html

@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
<h1 class="title">
Sponsor A Hacker
</h1>
{{if eq . false}}
isLoggedIn = {{.isLoggedIn}}
{{if eq .isLoggedIn false}}
<a href="/login" class="login-banner-link">Login</a>
{{ else }}
<a href="auth/logout/twitch" class="login-banner-link">Logout</a>

2
templates/index.html

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
{{template "pageheader" .isLoggedIn}}
{{template "pageheader" . }}
<div class="content">
<h2 class="difference">Set Goals. Support Dreams. Build Community.</h2>
<p class="product-description">Our platform connects aspiring tech professionals with a supportive community eager to help them succeed.

14
templates/welcome.html

@ -82,19 +82,7 @@ @@ -82,19 +82,7 @@
</style>
</head>
<body>
<div class="header">
<img src="assets/images/logo.jpg" class="logo"/>
<h1 class="title">
{{ .title }}
</h1>
{{if eq .isLoggedIn false}}
<a href="/login" class="login-banner-link">Login</a>
{{ else }}
<a href="auth/logout/twitch" class="login-banner-link">Logout</a>
{{ end }}
</div>
{{template "pageheader" . }}
<div class="dashboard-container">
<div class="dashboard-container">
<div class="welcome">

Loading…
Cancel
Save