mirror of
https://github.com/teamhanko/hanko.git
synced 2025-10-26 13:27:57 +08:00
fix: merge conflicts. remove import in quickstart
This commit is contained in:
@ -20,13 +20,9 @@ func main() {
|
||||
hankoElementUrl := getEnv("HANKO_ELEMENT_URL")
|
||||
hankoFrontendSdkUrl := getEnv("HANKO_FRONTEND_SDK_URL")
|
||||
hankoUrlInternal := hankoUrl
|
||||
domain := ""
|
||||
if value, ok := os.LookupEnv("HANKO_URL_INTERNAL"); ok {
|
||||
hankoUrlInternal = value
|
||||
}
|
||||
if value, ok := os.LookupEnv("DOMAIN"); ok {
|
||||
domain = value
|
||||
}
|
||||
|
||||
e := echo.New()
|
||||
e.Renderer = t
|
||||
@ -61,18 +57,6 @@ func main() {
|
||||
})
|
||||
}, middleware.SessionMiddleware(hankoUrlInternal))
|
||||
|
||||
e.GET("/logout", func(c echo.Context) error {
|
||||
cookie := &http.Cookie{
|
||||
Name: "hanko",
|
||||
Value: "",
|
||||
MaxAge: -1,
|
||||
HttpOnly: true,
|
||||
Domain: domain,
|
||||
}
|
||||
c.SetCookie(cookie)
|
||||
return c.Redirect(http.StatusTemporaryRedirect, "/")
|
||||
})
|
||||
|
||||
if err := e.Start(":8080"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
<meta name="theme-color" content="#042F4B">
|
||||
<title>Hanko Web Component Example</title>
|
||||
<link rel="stylesheet" href="static/css/index.css">
|
||||
<script type="module" src="{{.HankoElementUrl}}"></script>
|
||||
<link href="../static/img/Favicon_32x32.png" rel="shortcut icon" type="image/x-icon">
|
||||
<link href="../static/img/Favicon_256x256.png" rel="apple-touch-icon">
|
||||
</head>
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<nav class="nav">
|
||||
<ul class="nav__itemList">
|
||||
<li class="nav__listItem">
|
||||
<a class="nav__link" href="/logout">Logout</a>
|
||||
<a href="#" class="nav__link" id="logout-link">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@ -37,9 +37,22 @@
|
||||
<img alt="Powered by Hanko" src="static/img/poweredBy.svg"/>
|
||||
</footer>
|
||||
|
||||
|
||||
<script type="module">
|
||||
import {register} from "{{.HankoElementUrl}}";
|
||||
register({ shadow: false });
|
||||
|
||||
// TODO: Does this still work?
|
||||
const hanko = new hankoFrontendSdk.Hanko("{{.HankoUrl}}")
|
||||
|
||||
|
||||
document.getElementById("logout-link")
|
||||
.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
hanko.user.logout()
|
||||
.then(() => { window.location.href = "/" })
|
||||
.catch(console.error);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user