-
Notifications
You must be signed in to change notification settings - Fork 95
/
v6.ts
36 lines (28 loc) · 1.05 KB
/
v6.ts
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
import 'bootstrap/js/dist/collapse';
import 'bootstrap/js/dist/dropdown';
import 'bootstrap/js/dist/modal';
import 'dayjs/locale/ja';
import * as Turbo from '@hotwired/turbo';
import axios from 'axios';
import ujs from '@rails/ujs';
import dayjs from 'dayjs';
import Cookies from 'js-cookie';
import { Application } from 'stimulus';
import { definitionsFromContext } from 'stimulus/webpack-helpers';
import { getTimeZone } from './v6/utils/time-zone';
document.addEventListener('turbo:load', (_event) => {
const annConfig = (window as any).AnnConfig;
dayjs.locale(annConfig.viewer.locale);
Cookies.set('ann_time_zone', getTimeZone(), {
domain: `.${annConfig.domain}`,
secure: annConfig.rails.env === 'production',
});
axios.defaults.headers.common['X-CSRF-Token'] = document
.querySelector('meta[name="csrf-token"]')
?.getAttribute('content');
});
const application = Application.start();
const context = (require as any).context('./v6/controllers', true, /\.ts$/);
application.load(definitionsFromContext(context));
ujs.start();
Turbo.start();