const env = require('./env');

export default {
	// Global page headers: https://go.nuxtjs.dev/config-head
	head: {
		title: 'de-net-official',
		htmlAttrs: {
			lang: 'en',
		},
		meta: [{ charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { hid: 'description', name: 'description', content: '' }, { name: 'format-detection', content: 'telephone=no' }],
		link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
		script: [
			{
				src: 'https://www.googletagmanager.com/gtag/js?id=G-S376V42WBS',
				async: true,
			},
			{
				type: 'text/javascript',
				charset: 'utf-8',
				innerHTML: `window.dataLayer = window.dataLayer || [];
			  function gtag() { dataLayer.push(arguments); }
			  gtag('js', new Date());
			  gtag('config', 'G-S376V42WBS');`,
			},
		],
		__dangerouslyDisableSanitizers: ['script'],
	},

	// Global CSS: https://go.nuxtjs.dev/config-css
	css: [],

	// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
	plugins: ['plugins/vant'],

	// 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/bootstrap
		'bootstrap-vue/nuxt',
	],

	// Build Configuration: https://go.nuxtjs.dev/config-build
	build: {},

	router: {
		extendRoutes(routes, resolve) {
			routes.push(
				{
					name: 'Course',
					path: '/course',
					component: resolve(__dirname, 'pages/course/index.vue'),
				},
				{
					name: 'Authlogin',
					path: '/authlogin',
					component: resolve(__dirname, 'pages/auth/authLogin.vue'),
				},
				{
					name: 'Unlogin',
					path: '/unlogin',
					component: resolve(__dirname, 'pages/course/unLogin.vue'),
				},
				{
					name: 'RedPackage',
					path: '/:id?',
					component: resolve(__dirname, 'pages/index.vue'),
				},
				{
					name: 'LuckDraw',
					path: '/luckdraw/:id?',
					component: resolve(__dirname, 'pages/luckdraw.vue'),
				},
				{
					name: 'ToolBox',
					path: '/toolbox/:id',
					component: resolve(__dirname, 'pages/toolbox/index.vue'),
				},
				{
					name: 'Install',
					path: '/install',
					component: resolve(__dirname, 'pages/install.vue'),
				},
				{
					name: 'NFT',
					path: '/nft/:id/:account',
					component: resolve(__dirname, 'pages/nft/index.vue'),
				},
				{
					name: 'NftGroup',
					path: '/nft_group/:id',
					component: resolve(__dirname, 'pages/nft/group.vue'),
				},
				{
					name: 'Treasure',
					path: '/treasure/:id?',
					component: resolve(__dirname, 'pages/treasure/index.vue'),
				},
				{
					name: 'TreasureInvite',
					path: '/treasure/invite/:id/:channel?',
					component: resolve(__dirname, 'pages/treasure/invite.vue'),
				},
				{
					name: 'custom',
					path: '*',
					component: resolve(__dirname, 'pages/404.vue'),
				}
			);
		},
	},
	env: {
		NUXT_ENV: env[process.env.MODE],
	},
};
