fix: conflict

master
kunkka 4 years ago
commit e7f8bf107f

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

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

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

@ -1,4 +1,6 @@
import { isAccountLoggedIn } from "./auth"; import { isAccountLoggedIn } from "./auth";
import { refreshCookie } from "@/api/auth";
import dayjs from "dayjs";
import store from "@/store"; import store from "@/store";
export function isTrackPlayable(track) { export function isTrackPlayable(track) {
@ -75,3 +77,17 @@ export function updateHttps(url) {
if (!url) return ""; if (!url) return "";
return url.replace(/^http:/, "https:"); 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 { mapState } from "vuex";
import { getTrackDetail, getLyric } from "@/api/track"; import { getTrackDetail, getLyric } from "@/api/track";
import { userDetail, userPlaylist } from "@/api/user"; import { userDetail, userPlaylist } from "@/api/user";
import { randomNum } from "@/utils/common"; import { randomNum, dailyTask } from "@/utils/common";
import { getPlaylistDetail } from "@/api/playlist"; import { getPlaylistDetail } from "@/api/playlist";
import { playPlaylistByID } from "@/utils/play"; import { playPlaylistByID } from "@/utils/play";
import NProgress from "nprogress"; import NProgress from "nprogress";
@ -98,6 +98,7 @@ export default {
}, },
activated() { activated() {
this.loadData(); this.loadData();
dailyTask();
}, },
computed: { computed: {
...mapState(["settings"]), ...mapState(["settings"]),

Loading…
Cancel
Save