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)
    }
  }
})