This commit is contained in:
2020-12-04 15:38:33 +08:00
parent fe39b1244e
commit 617735df20
7 changed files with 12 additions and 5 deletions

View File

@@ -1,6 +1,10 @@
import { getValue } from '@/utils/common';
import axios from 'axios'
axios.defaults.baseURL = 'https://case.sy-my.net/beelink/public/home/';
if(getValue("time") < (new Date().getTime() - 12 * 60 * 60 * 1000)){
localStorage.removeItem("token")
localStorage.removeItem("time")
}
axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token");
axios.defaults.headers.common['Language'] = !getValue("Lanvuage") ? 'zh' : getValue("Lanvuage");
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

View File

@@ -30,6 +30,9 @@ export async function previewCover(file: any): Promise<string> {
*/
export function saveValue(key: string, value: any): boolean{
if(key == "token"){
saveValue("time",new Date().getTime())
}
if(typeof value == 'object'){
value = JSON.stringify(value)
}