Skip to content

Commit

Permalink
fix: fix the problem that the Logger plugin of vuex of electron versi…
Browse files Browse the repository at this point in the history
…on is loaded
  • Loading branch information
hq001 committed Dec 2, 2020
1 parent 55824b4 commit 135fcc2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const getSongDetail = async (

export const getPlayList = async (
id: number
): Promise<SongInteface.SongState['playlist'][]> => {
const data = await get<{ playlist: SongInteface.SongState['playlist'][] }>(
): Promise<SongInteface.SongState['playlist']> => {
const data = await get<{ playlist: SongInteface.SongState['playlist'] }>(
'/api/playlist/detail',
{
id
Expand Down
4 changes: 2 additions & 2 deletions src/pages/news/children/top-list/view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { uesModuleStore } from '@/hooks/index'
import { NAMESPACED, TopListState, TopListActions, Top } from '../module'
import { ProvideInject } from '@/pages/news/constant'
import { noop } from '@/utils/index'
import { SongsDetail } from '@/interface/index'
import { SongState } from '@/pages/song/module'
import { getPlayList } from '@/api/index'
import {
NAMESPACED as FooterNamespaced,
Expand All @@ -30,7 +30,7 @@ export const TopList = defineComponent({
)
const playMusic = async (songlistID: number, index: number) => {
footer.useMutations(FooterMutations.PAUES_MUSIC)
let songlist
let songlist: SongState['playlist']
if (cacheSongListDetail.has(songlistID)) {
songlist = cacheSongListDetail.get(songlistID)
} else {
Expand Down
7 changes: 6 additions & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createStore, MutationTree, createLogger } from 'vuex'
import modules from '../modules/index'
import { FooterMutations } from '@/pages/footer/module'
import { AllMutations } from '@/interface/index'
import { Platform } from '@/config/build'

export const enum Mutations {
SET_HISTORY_ROUTE = 'SET_HISTORY_ROUTE',
Expand Down Expand Up @@ -51,7 +52,11 @@ const mutations: MutationTree<RootState> = {

const plugins = []

if (process.env.NODE_ENV === 'development') {
let NODE_ENV = process.env.NODE_ENV
if (process.env.VUE_APP_PLATFORM === Platform.ELECTRON) {
NODE_ENV = process.env.VUE_APP_NODE_ENV
}
if (NODE_ENV === 'development') {
plugins.push(
createLogger({
filter(mutation) {
Expand Down

0 comments on commit 135fcc2

Please sign in to comment.