Initialize sentry after getting API status
This commit is contained in:
parent
839abcbd28
commit
986d12eab2
3 changed files with 17 additions and 10 deletions
|
|
@ -11,7 +11,7 @@ func AddRoutes(r *mux.Router) {
|
|||
router := resource.NewRouter(r)
|
||||
//r.Use(render.SetContentType(render.ContentTypeJSON))
|
||||
// Unauthenticated endpoints
|
||||
r.HandleFunc("/", handlerJSON(getRoot))
|
||||
r.HandleFunc("", handlerJSON(getRoot))
|
||||
r.HandleFunc("/signin", handlerJSONPost(postSignin))
|
||||
r.Handle("/signout", authenticatedHandlerBasic(postSignout))
|
||||
r.HandleFunc("/signup", handlerJSONPost(postSignup))
|
||||
|
|
|
|||
|
|
@ -3,9 +3,24 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import * as Sentry from "@sentry/vue";
|
||||
import { onMounted } from "vue";
|
||||
import { apiClient } from "@/client";
|
||||
import router from "@/router";
|
||||
|
||||
import { SSEManager, type SSEMessage } from "@/SSEManager";
|
||||
|
||||
async function sentryInit() {
|
||||
const config = await apiClient.JSONGet("/api");
|
||||
Sentry.init({
|
||||
dsn: config.DSN,
|
||||
integrations: [Sentry.browserTracingIntegration({ router })],
|
||||
environment: config.ENVIRONMENT,
|
||||
release: config.RELEASE,
|
||||
tracesSampleRate: 0.01,
|
||||
});
|
||||
console.log("sentry initialized");
|
||||
}
|
||||
onMounted(() => {
|
||||
SSEManager.connect("/api/events");
|
||||
SSEManager.subscribe((msg: SSEMessage) => {
|
||||
|
|
@ -13,5 +28,6 @@ onMounted(() => {
|
|||
console.log("SSE", msg);
|
||||
}
|
||||
});
|
||||
sentryInit();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { createApp } from "vue";
|
|||
import { createPinia } from "pinia";
|
||||
import App from "@/AppSync.vue";
|
||||
import router from "@/router";
|
||||
import * as Sentry from "@sentry/vue";
|
||||
import * as config from "@/config";
|
||||
|
||||
import "maplibre-gl/dist/maplibre-gl.css";
|
||||
|
|
@ -23,11 +22,3 @@ const app = createApp(App);
|
|||
app.use(pinia);
|
||||
app.use(router);
|
||||
app.mount("#app");
|
||||
|
||||
Sentry.init({
|
||||
dsn: config.DSN,
|
||||
integrations: [Sentry.browserTracingIntegration({ router })],
|
||||
environment: config.ENVIRONMENT,
|
||||
release: config.RELEASE,
|
||||
tracesSampleRate: 0.01,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue