

const TokenKey = 'User-Token'
const GameIdKey = 'Game-Id'
const RoleInfoKey = 'Role-Info'

// 获取token
export function getToken() {
    return localStorage.getItem(TokenKey) || ''
}

// 设置token
export function setToken(token: string) {
    return localStorage.setItem(TokenKey, token)
}

// 清除token
export function removeToken() {
    return localStorage.removeItem(TokenKey)
}

/******************************************/

// 获取GameId
export function getGameId() {
    return localStorage.getItem(GameIdKey) || ''
}

// 设置GameId
export function setGameId(gameId: string) {
    return localStorage.setItem(GameIdKey, gameId)
}

// 清除GameId
export function removeGameId() {
    return localStorage.removeItem(GameIdKey)
}

/******************************************/

// 获取角色信息
export function getRoleInfo() {
    return localStorage.getItem(RoleInfoKey) || ''
}

// 设置角色信息
export function setRoleInfo(roleInfo: string) {
    return localStorage.setItem(RoleInfoKey, roleInfo)
}

// 清除角色信息
export function removeRoleInfo() {
    return localStorage.removeItem(RoleInfoKey)
}