<template>
  <div class="min-h-full">
    <MainMenu
      :auth="auth"
      :years="years"
    />
    <main class="lg:ml-64 flex flex-col flex-1 py-8">
      <div class="px-4">
        <slot />
      </div>
    </main>
  </div>
</template>

<script setup>
import MainMenu from '@/Shared/MainMenu'
import { useToast } from 'vue-toastification'
import { defineProps, watch } from 'vue'

const props = defineProps({
  flash: Object,
  auth: Object,
  years: Object,
})

const toast = useToast()

watch(() => props.flash, flash => {
  if (flash.success) {
    toast.success(flash.success)
  }

  if (flash.error) {
    toast.error(flash.error)
  }
}, { immediate:true })
</script>
