Skip to content

Commit

Permalink
Add notification on /rebuild completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrench56 committed Jul 1, 2024
1 parent 39048aa commit 00f3220
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
<script lang="ts">
import { NotificationPriority, notify } from "$lib/notifications/notify";
import { onMount } from "svelte";
onMount(() => {
if (localStorage.getItem("rebuild") != null) {
notify({
title: "Site rebuilt",
priority: NotificationPriority.System,
duration: 2000,
options: {
body: localStorage.getItem("rebuild"),
},
notifyDesktop: false,
});
}
});
function rebuild() {
fetch("/rebuild", { method: "POST" }).then((response) => {
if (response.ok) {
response.text().then((text) => {
if (text.startsWith("REBUILT")) {
localStorage.setItem("rebuild", text.substring(8));
localStorage.setItem("rebuild", text.substring(9));
location.reload();
}
});
Expand Down

0 comments on commit 00f3220

Please sign in to comment.