2021-08-03 22:28:22 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
title: ""
|
|
|
|
nofollow: true
|
|
|
|
---
|
|
|
|
|
2021-08-30 16:58:12 +00:00
|
|
|
<script async type="module" src="/assets/api.js"></script>
|
|
|
|
|
2021-08-03 22:28:22 +00:00
|
|
|
<style>
|
|
|
|
#result.success { color: green; }
|
|
|
|
#result.fail { color: red; }
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<span id="result"></span>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
(async () => {
|
2021-08-30 16:58:12 +00:00
|
|
|
|
2021-08-03 22:28:22 +00:00
|
|
|
const resultSpan = document.getElementById("result");
|
|
|
|
|
2021-08-30 16:58:12 +00:00
|
|
|
try {
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
const unsubToken = urlParams.get('unsubToken');
|
2021-08-03 22:28:22 +00:00
|
|
|
|
2021-08-30 16:58:12 +00:00
|
|
|
if (!unsubToken) throw "No unsubscribe token provided";
|
2021-08-03 22:28:22 +00:00
|
|
|
|
2021-08-30 16:58:12 +00:00
|
|
|
const api = await import("/assets/api.js");
|
2021-08-03 22:28:22 +00:00
|
|
|
|
2021-08-31 02:08:51 +00:00
|
|
|
await api.call('/api/mailinglist/unsubscribe', {
|
2021-08-30 16:58:12 +00:00
|
|
|
body: { unsubToken },
|
|
|
|
});
|
2021-08-03 22:28:22 +00:00
|
|
|
|
2021-08-30 16:58:12 +00:00
|
|
|
resultSpan.className = "success";
|
|
|
|
resultSpan.innerHTML = "You have been unsubscribed! Please go on about your day.";
|
2021-08-03 22:28:22 +00:00
|
|
|
|
2021-08-30 16:58:12 +00:00
|
|
|
} catch (e) {
|
|
|
|
resultSpan.className = "fail";
|
|
|
|
resultSpan.innerHTML = e;
|
2021-08-03 22:28:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|