Files
portfolio/src/stores/burger.js
2023-06-20 09:16:28 +02:00

36 lines
703 B
JavaScript

import { defineStore } from 'pinia'
import router from '@/router'
export const useBurgerStore = defineStore('Burger', {
state: () => ({
checked: false,
}),
actions:
{
toggle(){
if (this.checked){
this.unCheck()
}
else{
this.check()
}
//console.log("checked by toggle ? : " + this.checked)
if (this.checked){
router.push({name:'profile'})
}
else {
router.push({name:'home'})
}
},
unCheck(){
this.checked = false;
//console.log("checked ? : " + this.checked)
},
check(){
this.checked = true;
//console.log("checked ? : " + this.checked)
}
}
})