UNPKG

@tencentcloud/chat-cs-uniapp

Version:

TCCC uniapp UIKit

18 lines (17 loc) 491 B
import { getCookie } from './cookie'; const excludeApis = ['/tccclogin/visitor/miniappLogin', '/ccc/wxlogin']; export const getAuthorization = (url) => { const userKey = getCookie('userKey'); let Authorization = ''; // 如果是 loginInstance之前使用的api,使用sessionKey2 // 否则使用sessionKey if (!excludeApis.includes(url) && userKey) { Authorization = `Bearer ${userKey}`; } if (Authorization) { return { Authorization, }; } return {}; };