always add the upload endpoint

This commit is contained in:
Khaleel Al-Adhami 2024-09-20 15:19:56 -07:00
parent 825463c494
commit 7e4e86ec57

View File

@ -66,7 +66,7 @@ from reflex.components.core.client_side_routing import (
Default404Page, Default404Page,
wait_for_client_redirect, wait_for_client_redirect,
) )
from reflex.components.core.upload import Upload, get_upload_dir from reflex.components.core.upload import get_upload_dir
from reflex.components.radix import themes from reflex.components.radix import themes
from reflex.config import get_config from reflex.config import get_config
from reflex.event import Event, EventHandler, EventSpec, window_alert from reflex.event import Event, EventHandler, EventSpec, window_alert
@ -404,7 +404,7 @@ class App(MiddlewareMixin, LifespanMixin, Base):
def _add_optional_endpoints(self): def _add_optional_endpoints(self):
"""Add optional api endpoints (_upload).""" """Add optional api endpoints (_upload)."""
# To upload files. # To upload files.
if Upload.is_used:
self.api.post(str(constants.Endpoint.UPLOAD))(upload(self)) self.api.post(str(constants.Endpoint.UPLOAD))(upload(self))
# To access uploaded files. # To access uploaded files.