1
+ import { createApp , markRaw , watch } from 'vue'
1
2
import '@/style/main.scss'
2
- import Vue , { markRaw , watch } from 'vue'
3
- import Router from 'vue-router'
4
3
import AppComponent from '@/app/App.vue'
5
- import { createApp } from '@/shared/compat'
6
4
import { components } from '@/shared/components'
7
5
import { setupRouter } from '@/shared/router'
8
6
import { useMainStore } from '@/shared/store'
9
7
import { API } from '@/shared/api'
10
8
import { createAuth } from '@/auth/service'
11
9
import { setupAudio , usePlayerStore } from './player/store'
12
10
import { createApi } from '@/shared'
13
- import { createPinia , PiniaVuePlugin } from 'pinia'
11
+ import { createPinia } from 'pinia'
14
12
import { useFavouriteStore } from '@/library/favourite/store'
15
13
import { usePlaylistStore } from '@/library/playlist/store'
16
14
17
- declare module 'vue/types/vue' {
18
- interface Vue {
15
+ declare module '@vue/runtime-core' {
16
+ interface ComponentCustomProperties {
17
+ $router : typeof router
19
18
$api : API
20
19
}
21
20
}
@@ -26,17 +25,12 @@ declare module 'pinia' {
26
25
}
27
26
}
28
27
29
- Vue . use ( Router )
30
- Vue . use ( PiniaVuePlugin )
31
-
32
28
const auth = createAuth ( )
33
29
const api = createApi ( auth )
34
30
const router = setupRouter ( auth )
35
31
36
32
const pinia = createPinia ( )
37
- . use ( ( { store } ) => {
38
- store . api = markRaw ( api )
39
- } )
33
+ . use ( ( ) => ( { api : markRaw ( api ) } ) )
40
34
41
35
const mainStore = useMainStore ( pinia )
42
36
const playerStore = usePlayerStore ( pinia )
50
44
return Promise . all ( [
51
45
useFavouriteStore ( ) . load ( ) ,
52
46
usePlaylistStore ( ) . load ( ) ,
53
- playerStore . loadQueue ( ) ,
47
+ // TODO
48
+ // playerStore.loadQueue(),
54
49
] )
55
50
}
56
51
} )
@@ -60,14 +55,16 @@ router.beforeEach((to, from, next) => {
60
55
next ( )
61
56
} )
62
57
63
- const app = createApp ( AppComponent , { router , pinia , store : playerStore } )
58
+ const app = createApp ( AppComponent )
64
59
65
- app . config . errorHandler = ( err : Error ) => {
60
+ app . config . errorHandler = ( err ) => {
66
61
// eslint-disable-next-line
67
62
console . error ( err )
68
- mainStore . setError ( err )
63
+ mainStore . setError ( err as Error )
69
64
}
70
65
66
+ app . use ( pinia )
67
+ app . use ( router )
71
68
app . use ( auth )
72
69
app . use ( api )
73
70
0 commit comments