60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
import Cookies from 'js-cookie'
|
||
|
||
const ApplicationKey = 'Admin-Application-Id'
|
||
const ApplicationKeywords = 'Admin-Application-Name'
|
||
|
||
/**
|
||
* 获取应用项目ID
|
||
* 该函数从Cookie中检索与应用项目相关的关键信息。
|
||
* @returns {string} 返回从Cookie中获取的应用项目ID。
|
||
*/
|
||
export function getApplicationId () {
|
||
return Cookies.get(ApplicationKey)
|
||
}
|
||
|
||
/**
|
||
* 获取应用项目ID
|
||
* 该函数从Cookie中检索与应用项目相关的关键信息。
|
||
* @returns {string} 返回从Cookie中获取的应用项目ID。
|
||
*/
|
||
export function getApplicationName () {
|
||
return Cookies.get(ApplicationKeywords)
|
||
}
|
||
|
||
/**
|
||
* 设置应用项目ID到Cookie中
|
||
* @param {string} ApplicationId - 需要设置的应用项目ID。
|
||
* @return {boolean|Object} 返回Cookie设置的结果。成功则返回true,失败则返回设置失败的对象。
|
||
*/
|
||
export function setApplicationId (ApplicationId) {
|
||
return Cookies.set(ApplicationKey, ApplicationId)
|
||
}
|
||
|
||
/**
|
||
* 设置应用项目名称到Cookie中
|
||
* @param {string} ApplicationId - 需要设置的应用项目名称。
|
||
* @return {boolean|Object} 返回Cookie设置的结果。成功则返回true,失败则返回设置失败的对象。
|
||
*/
|
||
export function setApplicationName (ApplicationName) {
|
||
return Cookies.set(ApplicationKeywords, ApplicationName)
|
||
}
|
||
|
||
/**
|
||
* 移除应用ID的Cookie
|
||
* 本函数用于删除与应用相关的ID Cookie。
|
||
* @returns {boolean} 返回删除操作的结果。如果删除成功,则返回true;如果删除失败,则返回false。
|
||
*/
|
||
export function removeApplicationId () {
|
||
return Cookies.remove(ApplicationKey)
|
||
}
|
||
|
||
/**
|
||
* 移除应用Name的Cookie
|
||
* 本函数用于删除与应用相关的Name Cookie。
|
||
* @returns {boolean} 返回删除操作的结果。如果删除成功,则返回true;如果删除失败,则返回false。
|
||
*/
|
||
export function removeApplicationName () {
|
||
return Cookies.remove(ApplicationKeywords)
|
||
}
|
||
|