Fix infinite loop when not logged in.
This commit is contained in:
parent
9beae26d0d
commit
71afacbbcb
1 changed files with 3 additions and 1 deletions
4
util.py
4
util.py
|
@ -1,5 +1,6 @@
|
|||
import shutil
|
||||
import textwrap
|
||||
from commands.login import login
|
||||
from typing import Any, Callable
|
||||
|
||||
from config import Config
|
||||
|
@ -25,8 +26,9 @@ def print_wrap(text: str, indent: str = '', end: str = '\n') -> None:
|
|||
|
||||
def require_login(function: Callable) -> Callable:
|
||||
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
||||
while 'api_token' not in Config['user']:
|
||||
if 'api_token' not in Config['user']:
|
||||
print('Not logged in. Please use the login command to log in.')
|
||||
return
|
||||
|
||||
return function(*args, **kwargs)
|
||||
|
||||
|
|
Loading…
Reference in a new issue