Appearance
用户
获取用户信息。如果用户未公开邮箱,属性 email 会返回 "未公开邮箱" 。
const TOKEN = '123456';
const url = 'https://gitee.com/api/v5/user';
const options = {method: 'GET', headers: {Authorization: 'Bearer ' + TOKEN}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}