import {get, post} from './index.ts'; /** * 判断是否已登录 */ export function isLogined(): Promise { return get('/authentication/authorized'); } /** * 确保已登录 */ export function ensureLogined(): Promise { return get('/authentication/validate'); } /** * 判断当前用户是否具有指定授权 * @param authority 授权 */ export function isGranted(authority: Authority): Promise { return get('/authentication/granted', authority); } /** * 确保当前用户已具有指定授权 * @param authority 授权 */ export function ensureGranted(authority: Authority): Promise { return get('/authentication/validate', authority); } export function logout(): Promise { return post('/logout'); }