ADD: Pinia
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
|
||||
import { createApp } from 'vue';
|
||||
import { createApp } from 'vue'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import App from './App.vue'
|
||||
import en from '@/lang/en.json'
|
||||
@@ -35,41 +35,16 @@ import en from '@/lang/en.json'
|
||||
import './assets/main.css'
|
||||
import './assets/index.css'
|
||||
|
||||
import { store } from '@/store.js'
|
||||
import Ajv from 'ajv'
|
||||
import schema from '@/data/profileSchema.json'
|
||||
import Axios from 'axios'
|
||||
|
||||
const ajv = new Ajv()
|
||||
|
||||
Axios.get('http://localhost:3001/profiles').then((res) => {
|
||||
const profiles = res.data
|
||||
console.log(profiles)
|
||||
const ids = new Set()
|
||||
const validate = ajv.compile(schema)
|
||||
store.device.profiles = profiles.filter((profile) => {
|
||||
if (!validate(profile)) {
|
||||
console.error('Failed to validate profile: ' + profile.name, validate.errors)
|
||||
return false
|
||||
}
|
||||
if (ids.has(profile.id)) {
|
||||
console.error('Duplicate profile id: ' + profile.id + ' for profile: ' + profile.name)
|
||||
return false
|
||||
}
|
||||
ids.add(profile.id)
|
||||
return true
|
||||
})
|
||||
}).catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
import { pinia } from '@/store.js'
|
||||
|
||||
// Create VueI18n instance with locales loaded from /lang directory
|
||||
const i18n = createI18n({
|
||||
locale: 'en',
|
||||
fallbackLocale: 'en',
|
||||
messages: { en: en },
|
||||
});
|
||||
locale: 'en',
|
||||
fallbackLocale: 'en',
|
||||
messages: { en: en },
|
||||
})
|
||||
|
||||
const app = createApp(App);
|
||||
const app = createApp(App)
|
||||
app.use(pinia)
|
||||
app.use(i18n)
|
||||
app.mount('#app');
|
||||
app.mount('#app')
|
||||
Reference in New Issue
Block a user