假设我有一堂课
class Service {
authenticated = false;
login() {
// login
this.authenticated = true;
}
unauthenticatedMethod() {
// everyone should have access
}
authenticatedMethod() {
// only if authenticated = true
}
}
我想要一个装饰器@authenticated
,可以将其添加到authenticatedMethod
方法中以检查authenticated
变量。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句