dosubot[bot] commented on issue #33353:
URL: https://github.com/apache/superset/issues/33353#issuecomment-2848864121
<!-- Answer -->
To resolve the issue with the API endpoint not accounting for the
`SUPERSET_APP_ROOT` subpath routing, you can modify the endpoint to dynamically
include the application root. This can be achieved by using the `getUrl` method
from the `SupersetClientClass` in the Superset SDK. Here's how you can adjust
the endpoint in your code:
Replace the hardcoded endpoint in `superset-frontend/src/embedded/index.tsx`
with a dynamic one:
```typescript
import { SupersetClient } from 'superset-ui-core';
const client = new SupersetClient();
const getMeWithRole = makeApi<void, { result: UserWithPermissionsAndRoles
}>({
method: 'GET',
endpoint: client.getUrl({ endpoint: '/api/v1/me/roles/' }), // Use getUrl
to include app root
});
```
This change will ensure that the API call correctly includes the
`SUPERSET_APP_ROOT` prefix, preventing the 404 error when accessing the
endpoint
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/utils/pathUtils.ts)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/49bd75fa-eaed-4ed8-bf46-367bb672b750?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/49bd75fa-eaed-4ed8-bf46-367bb672b750?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/49bd75fa-eaed-4ed8-bf46-367bb672b750?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/49bd75fa-eaed-4ed8-bf46-367bb672b750?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/49bd75fa-eaed-4ed8-bf46-367bb672b750?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/49bd75fa-eaed-4ed8-bf46-367bb672b750?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/49bd75fa-eaed-4ed8-bf46-367bb672b750?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]