123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- import axios from "axios";
- export default {
- // Global page headers: https://go.nuxtjs.dev/config-head
- head: {
- htmlAttrs: {
- lang: 'ru'
- },
- title: 'amic.ru',
- meta: [
- { name: 'viewport', content: 'width=device-width, initial-scale=1' }
- ],
- link: [
- { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
- ],
- script: [
- ],
- },
- plugins: [
- {}
- ],
- // Global CSS: https://go.nuxtjs.dev/config-css
- css: [
- "@/assets/styles/style.less"
- ],
- ssr: true,
- crossorigin: 'anonymous',
- // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
- plugins: [
- '~plugins/vue-alert.js',
- '~plugins/axios.js',
- '~plugins/vue-js-modal.js',
- '~plugins/v-clipboard.js',
- '~plugins/timeago.js',
- '~plugins/dropdown.js',
- '~plugins/vuelidate.js',
- '~plugins/paginate.js',
- '~plugins/vue-cookies.js',
- '~plugins/jsonld.js',
- ],
- // Auto import components: https://go.nuxtjs.dev/config-components
- components: true,
- // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
- // Modules: https://go.nuxtjs.dev/config-modules
- modules: [
- '@nuxtjs/style-resources',
- // https://go.nuxtjs.dev/axios
- '@nuxtjs/axios',
- '@nuxtjs/proxy',
- // https://go.nuxtjs.dev/pwa
- '@nuxtjs/pwa',
- '@nuxtjs/amp',
- '@nuxtjs/auth-next',
- 'vue-social-sharing/nuxt',
- '@nuxtjs/redirect-module',
- ],
- redirect: [
- {
- from: '/news/(\\d+)',
- to: async (from, req) => {
- const regex = new RegExp(from);
- const id = regex.exec(req.url)[1];
- const news = await axios
- .get(`https://api.amic.ru/api/v1/news/item/old_id_${id}`)
- .then((res) => res.data.data)
- .catch(() => null)
- if(!news) return '/news';
- return `/news/${news.category.alias}/${news.alias}`;
- },
- statusCode: 301
- },
- {
- from: '/podcasts/(\\d+)',
- to: async (from, req) => {
- const regex = new RegExp(from);
- const id = regex.exec(req.url)[1];
- const news = await axios
- .get(`https://api.amic.ru/api/v1/news/item/old_id_${id}`)
- .then((res) => res.data.data)
- .catch(() => null)
- if(!news) return '/news';
- return `/podcasts/${news.alias}`;
- },
- statusCode: 301
- },
- {
- from: '/voprosdnya/(\\d+)',
- to: async (from, req) => {
- const regex = new RegExp(from);
- const id = regex.exec(req.url)[1];
- const news = await axios
- .get(`https://api.amic.ru/api/v1/news/item/old_id_${id}`)
- .then((res) => res.data.data)
- .catch(() => null)
- if(!news) return '/news/voprosdnya';
- return `/news/voprosdnya/${news.alias}`;
- },
- statusCode: 301
- },
- ],
- styleResources: {
- less: []
- },
- privateRuntimeConfig: {
- apiUrl: process.env.API_URL
- },
- // Axios module configuration: https://go.nuxtjs.dev/config-axios
- axios: {
- proxy: true,
- prefix: "https://api.amic.ru/api/v1",
- headers: {
- }
- },
- proxy: {
- '/api/': { target: 'https://api.amic.ru/api/v1', pathRewrite: { '^/api/': '' } }
- },
- // PWA module configuration: https://go.nuxtjs.dev/pwa
- pwa: {
- manifest: {
- lang: 'ru'
- }
- },
- amp: {
- amp: true,
- css: '@/assets/css/amp.css',
- routeAliases: ['/news/:category/:alias']
- },
- colorMode: {
- preference: 'light'
- },
- router: {
-
- },
- auth: {
- plugins: [ {src: '~/plugins/axios', ssr: true}, '~/plugins/auth.js' ],
- redirect: {
- login: '/user/authorization',
- logout: '/',
- callback: '/login',
- home: '/'
- },
- strategies: {
- local: {
- token: {
- property: "data.access_token",
- name: "AccessToken",
- type: false,
- maxAge: 3240000,
- global: true,
- },
- user: {
- property: "data",
- },
- endpoints: {
- login: {
- url: "/user/authorization/login",
- method: "post"
- },
- user: {
- url: "/authorized/user/profile/info/current",
- method: "get",
- propertyName: "data"
- },
- logout: {
- url: "authorized/user/authorization/logout",
- method: "post"
- }
- }
- }
- }
- },
- // Build Configuration: https://go.nuxtjs.dev/config-build
- build: {
- extend(config) {
- config.resolve.alias.vue = 'vue/dist/vue.common'
- },
- },
- render: {
- compressor: false
- },
- buildModules: [
- '@nuxtjs/pwa',
- '@nuxtjs/vuetify',
- '@nuxt/typescript-build',
- '@nuxtjs/color-mode',
- '@nuxtjs/device'
- ]
- }
|