-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
76 lines (68 loc) · 2.02 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
import { BrowserTracing } from '@sentry/tracing';
import * as Sentry from '@sentry/vue';
import { ElMessage } from 'element-plus';
import 'element-plus/theme-chalk/index.css';
import { createApp } from 'vue';
import App from './App.vue';
import i18n from './i18n';
import router from './router';
import store from './store/index';
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
const app = createApp(App);
app.config.globalProperties.$formatDate = formatDate;
app.config.globalProperties.$displaySuccess = displaySuccess;
app.config.globalProperties.$displayError = displayError;
app.use(store).use(router).use(i18n);
Sentry.init({
app,
dsn: window.vars.sentryToken,
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ['localhost', 'https://lycee-tcg.eu'],
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
logErrors: true,
});
app.mount('#app');
function formatDate(value) {
if (typeof value === 'string') {
value = new Date(value);
}
return value ? dateFormatter.format(value) : '';
}
const toastDuration = 10000;
function displaySuccess(message) {
return ElMessage({
type: 'success',
message,
duration: toastDuration,
});
}
function displayError(message) {
return ElMessage({
type: 'error',
message,
duration: toastDuration,
});
}
const dateFormatter = new Intl.DateTimeFormat(void 0, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
});