Skip to content

Commit

Permalink
Make shutdown work
Browse files Browse the repository at this point in the history
  • Loading branch information
RehanSaeed committed Mar 25, 2022
1 parent 22eec0f commit 60b368a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Source/DotnetNewUI/Frontend/src/composables/Templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ if (process.env.NODE_ENV === "development") {
origin = "http://localhost:4999";
}

export function getOriginUrl() {
return origin;
}

export async function usePackages(): Promise<IResult<IPackage[]>> {
const { setIsLoading } = useLoading();
try {
Expand Down
4 changes: 3 additions & 1 deletion Source/DotnetNewUI/Frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { createApp } from "vue";
import { createMetaManager } from "vue-meta";
import App from "./App.vue";
import router from "./router";
import { getOriginUrl } from "@/composables/Templates";

window.onbeforeunload = function () {
fetch("/Shutdown", { method: "POST", keepalive: true });
const origin = getOriginUrl();
fetch(`${origin}/Shutdown`, { method: "POST", keepalive: true });
};

createApp(App).use(createMetaManager()).use(router).mount("#app");

0 comments on commit 60b368a

Please sign in to comment.