Skip to content

Commit

Permalink
Removed request_data and replaced it by request data provided by the …
Browse files Browse the repository at this point in the history
…context
  • Loading branch information
Alyxion committed Jun 30, 2024
1 parent 0737ebe commit d582e03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
13 changes: 6 additions & 7 deletions nicegui/outlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,13 @@ def setup_page(self, overwrite=False) -> Self:

@ui.page(self.base_path, **self.page_kwargs)
@ui.page(f'{self.base_path}' + '{_:path}', **self.page_kwargs) # all other pages
async def root_page(request_data=None):
async def root_page():
await ui.context.client.connected() # to ensure storage.tab and storage.client availability
initial_url = None
if request_data is not None:
initial_url = request_data['url']['path']
query = request_data['url'].get('query', None)
if query:
initial_url += '?' + query
request = context.client.request
initial_url = request.url.path
query = request.url.query
if query:
initial_url += '?' + query
self.build_page(initial_url=initial_url)

return self
Expand Down
12 changes: 0 additions & 12 deletions nicegui/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,6 @@ async def decorated(*dec_args, **dec_kwargs) -> Response:
with Client(self, request=request) as client:
if any(p.name == 'client' for p in inspect.signature(func).parameters.values()):
dec_kwargs['client'] = client
if any(p.name == 'request_data' for p in inspect.signature(func).parameters.values()):
url = request.url
dec_kwargs['request_data'] = {'client':
{'host': request.client.host,
'port': request.client.port},
'cookies': request.cookies,
'url':
{'path': url.path,
'query': url.query,
'username': url.username,
'password': url.password,
'fragment': url.fragment}}
result = func(*dec_args, **dec_kwargs)
if helpers.is_coroutine_function(func):
async def wait_for_result() -> None:
Expand Down

0 comments on commit d582e03

Please sign in to comment.