mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-18 14:18:03 +00:00
fix: bugs
This commit is contained in:
parent
603e39f362
commit
2c8ba10e20
7 changed files with 59 additions and 80 deletions
|
|
@ -1,10 +1,10 @@
|
|||
import axios from "axios";
|
||||
import Cookies from "js-cookie";
|
||||
import axios from 'axios';
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
let baseURL = "";
|
||||
let baseURL = '';
|
||||
// Web 和 Electron 跑在不同端口避免同时启动时冲突
|
||||
if (process.env.IS_ELECTRON) {
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
baseURL = process.env.VUE_APP_ELECTRON_API_URL;
|
||||
} else {
|
||||
baseURL = process.env.VUE_APP_ELECTRON_API_URL_DEV;
|
||||
|
|
@ -21,18 +21,18 @@ const service = axios.create({
|
|||
|
||||
service.interceptors.request.use(function (config) {
|
||||
if (!config.params) config.params = {};
|
||||
if (baseURL[0] !== "/") {
|
||||
config.params.cookie = `MUSIC_U=${Cookies.get("MUSIC_U")};`;
|
||||
if (baseURL[0] !== '/' && !process.env.IS_ELECTRON) {
|
||||
config.params.cookie = `MUSIC_U=${Cookies.get('MUSIC_U')};`;
|
||||
}
|
||||
return config;
|
||||
});
|
||||
|
||||
service.interceptors.response.use(
|
||||
(response) => {
|
||||
response => {
|
||||
const res = response.data;
|
||||
return res;
|
||||
},
|
||||
(error) => {
|
||||
error => {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue