A fast and simple blog backend.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
mediocre-blog/srv/src/http/tpl/finalize.html

45 lines
951 B

{{ define "body" }}
<script async type="module" src="{{ StaticURL "api.js" }}"></script>
<style>
#result.success { color: green; }
#result.fail { color: red; }
</style>
<span id="result"></span>
<script>
(async () => {
const resultSpan = document.getElementById("result");
try {
const urlParams = new URLSearchParams(window.location.search);
const subToken = urlParams.get('subToken');
if (!subToken) throw "No subscription token provided";
const api = await import("{{ StaticURL "api.js" }}");
await api.call('/api/mailinglist/finalize', {
body: { subToken },
});
resultSpan.className = "success";
resultSpan.innerHTML = "Your email subscription has been finalized! Please go on about your day.";
} catch (e) {
resultSpan.className = "fail";
resultSpan.innerHTML = e;
}
})();
</script>
{{ end }}
{{ template "base.html" . }}