Skip to content

Commit

Permalink
feat: create migration Nuxt plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jul 20, 2022
1 parent 921e199 commit 7b1e76a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
32 changes: 17 additions & 15 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default {
title: null,

titleTemplate: (titleChunk) => {
return titleChunk ? `${ titleChunk } | Rule 34 App` : 'Rule 34 App – Popular Hentai Porn'
return titleChunk
? `${titleChunk} | Rule 34 App`
: 'Rule 34 App – Popular Hentai Porn'
},

htmlAttrs: {
Expand All @@ -43,7 +45,7 @@ export default {
name: 'description',
content:
'Browse popular Rule 34 Hentai Porn for free. Without ads.' +
' We have Anime, Pokemon, Fortnite, Naruto, FNF, FNAF, CountryHumans, Brawl Stars, Gay, Video…'
' We have Anime, Pokemon, Fortnite, Naruto, FNF, FNAF, CountryHumans, Brawl Stars, Gay, Video…',
},
{
name: 'monetization',
Expand Down Expand Up @@ -76,17 +78,18 @@ export default {
loadingIndicator: {
name: 'cube-grid',
color: TAILWIND_CONFIG.theme.extend.colors.darkGray[700],
background: `linear-gradient(152deg, ${ TAILWIND_CONFIG.theme.extend.colors.primary[400] } 38%, ${ TAILWIND_CONFIG.theme.extend.colors.accent[400] } 90%)`,
background: `linear-gradient(152deg, ${TAILWIND_CONFIG.theme.extend.colors.primary[400]} 38%, ${TAILWIND_CONFIG.theme.extend.colors.accent[400]} 90%)`,
},

css: ['~/assets/css/main.css'],

components: [{ path: '~/components', pathPrefix: false }],

plugins: [
{ src: '~/plugins/vuex-router-sync.js', mode: 'client' },
{ src: '~/plugins/vuex-persist.js', mode: 'client' },
{ src: '~/plugins/pwa-update.js', mode: 'client' },
{ src: '~/plugins/vuex-persist.js', mode: 'client' },
{ src: '~/plugins/migrate-state.js', mode: 'client' },
{ src: '~/plugins/vuex-router-sync.js', mode: 'client' },
{ src: '~/plugins/vue-matomo.js', mode: 'client' },
],

Expand Down Expand Up @@ -115,7 +118,7 @@ export default {
'@nuxtjs/pwa',
'@nuxtjs/sentry',
'@nuxtjs/sitemap',
'@nuxtjs/toast'
'@nuxtjs/toast',
],

axios: {
Expand Down Expand Up @@ -152,13 +155,13 @@ export default {
},

endpoints: {
login: { url: `${ process.env.API_URL }/auth/log-in`, method: 'post' },
login: { url: `${process.env.API_URL}/auth/log-in`, method: 'post' },
refresh: {
url: `${ process.env.API_URL }/auth/refresh`,
url: `${process.env.API_URL}/auth/refresh`,
method: 'post',
},
logout: false,
user: { url: `${ process.env.API_URL }/auth/profile`, method: 'get' },
user: { url: `${process.env.API_URL}/auth/profile`, method: 'get' },
},
},
},
Expand Down Expand Up @@ -199,8 +202,8 @@ export default {
],
},
meta: {
ogHost: `https://${ process.env.APP_DOMAIN }`,
mobileAppIOS: true
ogHost: `https://${process.env.APP_DOMAIN}`,
mobileAppIOS: true,
},
// Icon is automatically proccessed from static/icon.png
},
Expand Down Expand Up @@ -278,7 +281,7 @@ export default {
},

sitemap: {
hostname: `https://${ process.env.APP_DOMAIN }`,
hostname: `https://${process.env.APP_DOMAIN}`,

defaults: {
changefreq: 'daily',
Expand Down Expand Up @@ -310,16 +313,15 @@ export default {
class: 'toasted-custom-action',

onClick: (e, toastObject) => {
toastObject.goAway(0);
}
toastObject.goAway(0)
},
},

theme: 'toasted-custom-theme',

closeOnSwipe: true,
},


build: {
extractCSS: true,
},
Expand Down
11 changes: 11 additions & 0 deletions plugins/migrate-state.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { migrateState } from '~/assets/js/MigrateState'

export default (context) => {
const { store } = context

const state = structuredClone(store.state)

const migratedState = migrateState(state)

store.replaceState(migratedState)
}

0 comments on commit 7b1e76a

Please sign in to comment.