chet novoe
This commit is contained in:
@@ -21,6 +21,7 @@ import ToolBar from "@/components/ToolBar.vue";
|
|||||||
import axiosSetup from "@/services/axiosSetup";
|
import axiosSetup from "@/services/axiosSetup";
|
||||||
import {onMounted} from "vue";
|
import {onMounted} from "vue";
|
||||||
import {subscribeUserToPush} from "@/services/pushManager";
|
import {subscribeUserToPush} from "@/services/pushManager";
|
||||||
|
import apiClient from "@/plugins/axios";
|
||||||
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@@ -30,11 +31,7 @@ onMounted(async () => {
|
|||||||
console.log("Push subscription:", subscription);
|
console.log("Push subscription:", subscription);
|
||||||
|
|
||||||
// Отправка подписки на сервер для хранения
|
// Отправка подписки на сервер для хранения
|
||||||
await fetch("http://localhost:8000/api/v1/push/subscribe", {
|
await apiClient.post("http/api/v1/push/subscribe", subscription)
|
||||||
method: "POST",
|
|
||||||
headers: {"Content-Type": "application/json", "Authorization": `Bearer ${localStorage.getItem("token")}`},
|
|
||||||
body: JSON.stringify(subscription),
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to subscribe to push:", error);
|
console.error("Failed to subscribe to push:", error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user