1
This commit is contained in:
commit
8c95bbf909
126 files changed
+16922
No files matched your search
@@ -0,0 +1,53 @@
|
||||
// Utilities
|
||||
import { defineStore } from 'pinia'
|
||||
import {ref, watch} from 'vue'
|
||||
import { clearAxios, spravURL } from '@/utils/axios-api'
|
||||
import VueJwtDecode from 'vue-jwt-decode'
|
||||
import {checkremote} from '@/utils/universal_functions'
|
||||
import {useAppStore} from '@/store/app.js'
|
||||
|
||||
|
||||
export const useAccountStore = defineStore('AccountStore', () => {
|
||||
const AppStore = useAppStore()
|
||||
|
||||
const user=ref({})
|
||||
const cod2user=ref(false)
|
||||
const setUser = (value)=> {
|
||||
value.photo = checkremote(`${spravURL}${value.login}.jpg`)
|
||||
user.value=value
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// геттер бывший
|
||||
// const getUser=computed(()=> uyser.value)
|
||||
|
||||
const logging=async (anon)=>{
|
||||
console.log(anon)
|
||||
AppStore.loading = true
|
||||
const result = await clearAxios.post('api/accounts/token/', anon)
|
||||
// .then(result => {
|
||||
localStorage.setItem('access', result.data.access)
|
||||
localStorage.setItem('refresh', result.data.refresh)
|
||||
|
||||
let u = VueJwtDecode.decode(result.data.refresh)
|
||||
u.user.photo = checkremote( `${spravURL}${u.user.login}.jpg`)
|
||||
// `${spravURL}${u.user.login}.jpg`
|
||||
user.value = u.user
|
||||
AppStore.loading = false
|
||||
}
|
||||
const logout =()=>{
|
||||
user.value = {}
|
||||
localStorage.removeItem('access')
|
||||
localStorage.removeItem('refresh')
|
||||
|
||||
}
|
||||
watch(user, (newValue,oldValue)=>{
|
||||
cod2user.value = 'login' in newValue && newValue.login.startsWith('9966-')?true:false
|
||||
}, {deep:true})
|
||||
|
||||
|
||||
|
||||
return {user, setUser,cod2user,logging, logout}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import {ref} from 'vue'
|
||||
import { clearAxios } from '@/utils/axios-api'
|
||||
export const useMainmenuStore = defineStore('MainmenuStore', () => {
|
||||
const portallinks = ref([])
|
||||
|
||||
const loadlinks=async()=>{
|
||||
const res = await clearAxios.get('api/navigation/carousels/')
|
||||
portallinks.value=res.data
|
||||
}
|
||||
return {portallinks,loadlinks}
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import {ref} from 'vue'
|
||||
import { clearAxios } from '@/utils/axios-api'
|
||||
export const useMainmenuStore = defineStore('MainmenuStore', () => {
|
||||
const portallinks = ref([])
|
||||
|
||||
const loadlinks=async()=>{
|
||||
const res = await clearAxios.get('api/navigation/carousels/')
|
||||
portallinks.value=res.data
|
||||
}
|
||||
return {portallinks,loadlinks}
|
||||
})
|
||||
@@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import {ref, watch} from 'vue'
|
||||
import { clearAxios } from '@/utils/axios-api'
|
||||
|
||||
export const useMainmenuStore = defineStore('MainmenuStore', () => {
|
||||
const portallinks = ref([])
|
||||
// const setUser = (value)=> {links.value=value}
|
||||
|
||||
//
|
||||
// геттер бывший
|
||||
// const getUser=computed(()=> uyser.value)
|
||||
// вотч
|
||||
// watch(()=>movies,(state)=>{
|
||||
// localStorage.setItem('movies',JSON.stringify(state)),{deep:true}
|
||||
// }
|
||||
// )
|
||||
const loadlinks=async()=>{
|
||||
const res = await clearAxios.get('api/navigation/links/')
|
||||
portallinks.value=res.data
|
||||
}
|
||||
return {portallinks,loadlinks}
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
// Utilities
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export const useAppStore = defineStore('app', () => {
|
||||
const loading = ref(false)
|
||||
const countvisitor = ref({ "totalvisit": 0,
|
||||
"visittoday":0,
|
||||
"uniqtoday" : 0})
|
||||
return {loading,countvisitor}
|
||||
|
||||
},
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
// Utilities
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
export default createPinia()
|
||||
Reference in new issue
Block a user