fix: conflict

master
kunkka 4 years ago
commit e7f8bf107f

@ -42,7 +42,7 @@ export function loginWithEmail(params) {
* 说明 : 调用此接口 , 可刷新登录状态
* - 调用例子 : /login/refresh
*/
export function loginRefresh() {
export function refreshCookie() {
return request({
url: "/login/refresh",
method: "post",

@ -8,6 +8,7 @@ import "@/assets/icons";
import "@/utils/filters";
import { initMediaSession } from "@/utils/mediaSession";
import "./registerServiceWorker";
import { dailyTask } from "@/utils/common";
import * as Sentry from "@sentry/browser";
import { Vue as VueIntegration } from "@sentry/integrations";
@ -41,6 +42,8 @@ if (process.env.VUE_APP_ENABLE_SENTRY === "true") {
});
}
dailyTask();
new Vue({
i18n,
store,

@ -86,6 +86,9 @@ const initState = {
},
lang: null,
musicQuality: 320000,
showGithubIcon: true,
showPlaylistsByAppleMusic: true,
lastRefreshCookieDate: 0,
},
};

@ -1,4 +1,6 @@
import { isAccountLoggedIn } from "./auth";
import { refreshCookie } from "@/api/auth";
import dayjs from "dayjs";
import store from "@/store";
export function isTrackPlayable(track) {
@ -75,3 +77,17 @@ export function updateHttps(url) {
if (!url) return "";
return url.replace(/^http:/, "https:");
}
export function dailyTask() {
if (
store.state.settings.lastRefreshCookieDate === undefined ||
store.state.settings.lastRefreshCookieDate !== dayjs().date()
) {
console.log("execute dailyTask");
store.commit("updateSettings", {
key: "lastRefreshCookieDate",
value: dayjs().date(),
});
refreshCookie();
}
}

@ -58,7 +58,7 @@
import { mapState } from "vuex";
import { getTrackDetail, getLyric } from "@/api/track";
import { userDetail, userPlaylist } from "@/api/user";
import { randomNum } from "@/utils/common";
import { randomNum, dailyTask } from "@/utils/common";
import { getPlaylistDetail } from "@/api/playlist";
import { playPlaylistByID } from "@/utils/play";
import NProgress from "nprogress";
@ -98,6 +98,7 @@ export default {
},
activated() {
this.loadData();
dailyTask();
},
computed: {
...mapState(["settings"]),

Loading…
Cancel
Save