import qs from "query-string";
import { storeData } from "../store";

/** 管乐迷获取 url前缀 */
export const getRequestHostname = () => {
	const blank = ["mteadev.dayaedu.com", "mteatest.dayaedu.com", "mteaonline.dayaedu.com"];
	const webBlank = ["mandev.dayaedu.com", "mantest.dayaedu.com", "manonline.dayaedu.com"];

	if (blank.includes(location.hostname)) {
		return "/api-teacher";
	} else if (webBlank.includes(location.hostname)) {
		return "/api-web";
	}
	return "/api-student";
};

// 后台管理，教学伴奏预览专用参数
const whiteUrl = () => {
	const parseSearch: any = qs.parse(location.search);
	return {
		"/sysMusicScoreCategories/queryTree": "/eduMusicScore/queryTree",
		"/sysMusicScoreAccompaniment/queryPage": !parseSearch.platform ? "/eduMusicScore/queryPage" : "/sysMusicScoreAccompaniment/queryPage",
		"/sysMusicScoreAccompaniment/queryPageLimit": "/eduMusicScore/queryPageLimit",
		"/sysMusicScoreAccompaniment/querySubjectIds": "/eduMusicScore/querySubjectIds",
	};
};
export default whiteUrl;
