mirror of
https://github.com/efim/go-ssr-pocketbase-oauth-attempt.git
synced 2025-12-14 20:43:38 +00:00
feat: middleware to return error as html
This commit is contained in:
10
pages/templates/errors/401.gohtml
Normal file
10
pages/templates/errors/401.gohtml
Normal file
@@ -0,0 +1,10 @@
|
||||
{{ define "title" }}
|
||||
Not Authorized
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<main hx-boost="true" class="px-10 pt-10 flex flex-col gap-y-10">
|
||||
The page you are trying to access requires authorization.
|
||||
Please log in.
|
||||
</main>
|
||||
{{ end }}
|
||||
9
pages/templates/errors/404.gohtml
Normal file
9
pages/templates/errors/404.gohtml
Normal file
@@ -0,0 +1,9 @@
|
||||
{{ define "title" }}
|
||||
Page Not Found
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<main hx-boost="true" class="px-10 pt-10 flex flex-col gap-y-10">
|
||||
Error 404 means the page was not found
|
||||
</main>
|
||||
{{ end }}
|
||||
10
pages/templates/errors/error.gohtml
Normal file
10
pages/templates/errors/error.gohtml
Normal file
@@ -0,0 +1,10 @@
|
||||
{{ define "title" }}
|
||||
Error occurred
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<main hx-boost="true" class="px-10 pt-10 flex flex-col gap-y-10">
|
||||
<p> Error {{ .ErrorCode }} occurred! </p>
|
||||
<p> {{ .ErrorText }} </p>
|
||||
</main>
|
||||
{{ end }}
|
||||
@@ -13,6 +13,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
{{ else }}
|
||||
<p>Rendering this on the backend, passing values from the code: {{ .BackendMessage }}</p>
|
||||
<p>There will be some content only for authorized users</p>
|
||||
{{ end }}
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user