<template>
    <div>
      <CustomSubHeader>
        <CBreadcrumb class="border-0 mb-0">برند ها</CBreadcrumb>
        <CButton size="sm" color="primary" class="mr-auto" :to="{ name: 'admin-brands' }">برگشت به صفحه قبل</CButton>
        <CButton v-if="$route.params.item === 'new'" size="sm" color="success" style="margin-right: 10px" @click="add"
          >افزودن</CButton
        >
        <CButton v-else size="sm" color="success" style="margin-right: 10px" @click="update">بروزرسانی</CButton>
      </CustomSubHeader>
      <CRow>

      </CRow>
    </div>
  </template>
  
  <script>
  export default {
    name: 'AddminBrandsItem',
    layout: 'admin',
    async asyncData({ $axios, params, error }) {
      try {
        const data = {}
        if (params.admin !== 'new') {
          const brand = await $axios.get(`/api/admin/brand/${params.item}`)
          data.brand = brand.data
        }
        return data
      } catch (e) {
        error({ status: 404, message: 'Page not found' })
      }
    },
    data() {
      return {
        brand: {

        },
        validation: {},

      }
    },
    head() {
      return {
        title: "برندها"
      }
    },
    methods: {

    }
  }
  </script>
  