Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to configure backend API and frontend client #101

Merged
merged 7 commits into from
Jun 20, 2024

Conversation

pamella
Copy link
Collaborator

@pamella pamella commented Jun 19, 2024

Issues

Resolves #55

Description

Allow users to configure backend API (Django Ninja) and frontend client (openapi-ts)

Screencast.from.19-06-2024.15.30.24.webm

image

docs/tutorial.md Outdated Show resolved Hide resolved
docs/tutorial.md Outdated Show resolved Hide resolved
docs/tutorial.md Outdated Show resolved Hide resolved
@@ -16,7 +16,7 @@ const theme = createTheme({});

// Relates to path("ai-assistant/", include("django_ai_assistant.urls"))
// which can be found at example/demo/urls.py)
configAIAssistant({ baseURL: "ai-assistant" });
configAIAssistant({ BASE: "ai-assistant" });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this has changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we are now using the OpenAPIConfig as props to make override the client config easier.

export const OpenAPI: OpenAPIConfig = {
BASE: '',
CREDENTIALS: 'include',
ENCODE_PATH: undefined,
HEADERS: undefined,
PASSWORD: undefined,
TOKEN: undefined,
USERNAME: undefined,
VERSION: '0.0.1',
WITH_CREDENTIALS: false,
interceptors: {
request: new Interceptors(),
response: new Interceptors(),
},
};

Copy link
Member

@fjsj fjsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Please check comments.

@pamella pamella requested a review from fjsj June 20, 2024 13:01
@pamella pamella merged commit a3a1190 into main Jun 20, 2024
6 checks passed
@pamella pamella deleted the feat/custom-config-ninja-api branch June 20, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to configure NinjaAPI
2 participants