Skip to content

Commit

Permalink
Stuck on vue-demi issue vueuse/vue-demi#171
Browse files Browse the repository at this point in the history
  • Loading branch information
knirirr committed Oct 22, 2024
1 parent 6f18205 commit e0ea1a6
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 16 deletions.
24 changes: 18 additions & 6 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ export default {
css: ["@/assets/styles/layout.css", "animate.css/animate.min.css", "@/assets/styles/colors.css"],
plugins: ["@/plugins/particles"],
components: true,
buildModules: ['@nuxtjs/eslint-module', '@nuxtjs/vuetify'],
buildModules: [
'@nuxtjs/eslint-module',
'@nuxtjs/vuetify',
['@pinia/nuxt', { disableVuex: false}]
],
modules: ['@nuxtjs/axios', '@nuxtjs/pwa', ['nuxt-highcharts', {}]],
axios: { baseURL: '/', headers: { common: { Accept: 'application/json' }}},
pwa: { manifest: { lang: 'en' }},
Expand All @@ -29,11 +33,19 @@ export default {
router: { middleware: 'auth' },
build: {
extend(config) {
config.module.rules.push({
test: /\.ya?ml$/,
type: 'json',
use: 'yaml-loader'
})
const rules = [
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
},
{
test: /\.ya?ml$/,
type: 'json',
use: 'yaml-loader'
}
]
config.module.rules.push(...rules)
}
}
}
86 changes: 78 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@nuxtjs/eslint-config": "^8.0.0",
"@nuxtjs/eslint-module": "^3.0.2",
"@nuxtjs/vuetify": "^1.12.3",
"@pinia/nuxt": "0.2.1",
"@vue/cli-plugin-babel": "5.0.8",
"@vue/test-utils": "^1.3.0",
"babel-core": "7.0.0-bridge.0",
Expand All @@ -47,9 +48,9 @@
"eslint-plugin-vue": "^8.2.0",
"jest": "^27.4.4",
"jest-transform-yaml": "^1.1.2",
"sinon": "^18.0.0",
"vue-jest": "^3.0.4",
"webpack-cli": "^4.10.0",
"sinon": "^18.0.0"
"webpack-cli": "^4.10.0"
},
"browserslist": [
"> 0.25%",
Expand Down
39 changes: 39 additions & 0 deletions src/stores/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { defineStore } from 'pinia';
import RESTClient from "../lib/RESTClient";

const restClient = new RESTClient();

export const useAppStore = defineStore('app', {
state: () => ({
booted: false,
}),
getters: {
getToken: () => {
const user = JSON.parse(localStorage.getItem("user"));
return user ? user.token : null
}
},
actions: {
async bootApp (state) {
const token = this.getToken()
if (!state.booted && token) {
try { await restClient.test_token(token) }
catch (error) {
this.commit('user/logout')
localStorage.removeItem("user")
}
finally {
this.setBooted(true);
}
}
else {
this.setBooted(true);
}
},
setBooted(state, value) {
state.booted = value;
}
}
})


0 comments on commit e0ea1a6

Please sign in to comment.