const webpack = require("webpack")
export default {
  // Global page headers (https://go.nuxtjs.dev/config-head)
  head: {
    title: 'اراک ریل',
    meta: [
      {charset: 'utf-8'},
      {name: 'viewport', content: 'width=device-width, initial-scale=1'},
      {name: 'theme-color', content: '#303030'},
    ],
    link: [
      {rel: 'icon', type: 'image/x-icon', href: '/favicon.png'}
    ]
  },

  // Global CSS (https://go.nuxtjs.dev/config-css)
  loading: {
    color: '#1B407C'
  },
  css: [
    'slick-carousel/slick/slick.css',
    'slick-carousel/slick/slick-theme.css',
    'element-ui/lib/theme-chalk/index.css',
    '~/assets/css/bootstrap-grid.css',
    '~/assets/css/reset-css.css',
    '~/assets/css/fontawesome/css/all.min.css',
    '~/assets/sass/main.scss'
  ],

  // Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
  plugins: [
    '@/plugins/element-ui',
    '@/plugins/ckEditor.client',
    '@/plugins/datePicker.client',
    '@/plugins/gsap.client'
  ],

  // Auto import components (https://go.nuxtjs.dev/config-components)
  components: true,

  // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
  buildModules: [],

  // Modules (https://go.nuxtjs.dev/config-modules)
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    '@nuxtjs/auth'
  ],

  // Axios module configuration (https://go.nuxtjs.dev/config-axios)
  axios: {
    proxy: true
  },
  proxy: {
    '/api': {target: 'http://127.0.0.1:7320'}
  },

  // Build Configuration (https://go.nuxtjs.dev/config-build)
  build: {
    transpile: [/^element-ui/],

    plugins: [new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery',
      'window.jQuery': 'jquery'
    })]
  },
  router: {
    middleware: ['redirects'],
    linkActiveClass: 'active'
  },
  server: {
    host: '0.0.0.0',
    port: 7320
  },
  serverMiddleware: ['~/api/index'],
  auth: {
    rewriteRedirects: true,
    redirect: false,
    strategies: {
      local: {
        endpoints: {
          login: {url: '/api/auth/admin/login', method: 'post', propertyName: 'token'},
          logout: {url: '/api/auth/admin/logout', method: 'post'},
          user: {url: '/api/auth/admin/user', method: 'get', propertyName: 'user'}
        },
        tokenRequired: true,
        tokenType: '',
        globalToken: true,
        autoFetchUser: true
      }
    }
  }
}
