chet novoe
This commit is contained in:
29
src/App.vue
29
src/App.vue
@@ -2,15 +2,15 @@
|
||||
|
||||
<div id="app" class="flex flex-col h-screen bg-gray-100 gap-4">
|
||||
<!-- MenuBar всегда фиксирован сверху -->
|
||||
<MenuBar class="w-full sticky hidden lg:block top-0 z-10"/>
|
||||
<MenuBar class="w-full sticky hidden lg:block top-0 z-10"/>
|
||||
<ToolBar class=" fixed visible lg:invisible bottom-0 z-10"/>
|
||||
|
||||
<!-- Контентная часть заполняет оставшееся пространство -->
|
||||
<div class="flex-grow ">
|
||||
|
||||
<router-view />
|
||||
<router-view/>
|
||||
</div>
|
||||
<OverlayView class="w-full sticky invisible lg:visible top-0 z-10"/>
|
||||
<OverlayView class="w-full sticky invisible lg:visible top-0 z-10"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -18,6 +18,29 @@
|
||||
import MenuBar from "./components/MenuBar.vue";
|
||||
import OverlayView from "@/components/OverlayView.vue";
|
||||
import ToolBar from "@/components/ToolBar.vue";
|
||||
import axiosSetup from "@/services/axiosSetup";
|
||||
import {onMounted} from "vue";
|
||||
import {subscribeUserToPush} from "@/services/pushManager";
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
try {
|
||||
const subscription = await subscribeUserToPush();
|
||||
console.log("Push subscription:", subscription);
|
||||
|
||||
// Отправка подписки на сервер для хранения
|
||||
await fetch("http://localhost:8000/api/v1/push/subscribe", {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json", "Authorization": `Bearer ${localStorage.getItem("token")}`},
|
||||
body: JSON.stringify(subscription),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to subscribe to push:", error);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
// @Options({
|
||||
// components: {
|
||||
|
||||
Reference in New Issue
Block a user