Conversation
Co-authored-by: Yukaii <4230968+Yukaii@users.noreply.github.com>
✅ Deploy Preview for disfactory-frontend ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Copilot
AI
changed the title
[WIP] Supporting the ability to switch the backend API base URL during flight
Add runtime API base URL configuration modal for testing and development
Jun 22, 2025
Contributor
|
@copilot . master branch works fine. Uncaught Error: [vue-composition-api] must call Vue.use(plugin) before using any function. |
Co-authored-by: Yukaii <4230968+Yukaii@users.noreply.github.com>
Contributor
Author
Fixed the Vue Composition API error by migrating from the external @vue/composition-api plugin to Vue 2.7.16's built-in Composition API support. The issue was caused by initialization order conflicts where composition API functions were being called during module imports before Vue.use() was executed. Commit 0f6e54e resolves this by updating all imports to use Vue's built-in composition API. |
…ssues Co-authored-by: Yukaii <4230968+Yukaii@users.noreply.github.com>
- Removed dependency on @vue/composition-api from package.json. - Updated components to use Vue 3's defineComponent instead of createComponent. - Simplified global state management for app state, modal state, and alert state by removing provide/inject patterns. - Refactored various components to align with Vue 3's reactivity system. - Removed unused imports and cleaned up code for better readability. - Deleted obsolete test file for TutorialModal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a new feature that allows users to switch the backend API base URL during runtime without rebuilding the application. This is primarily intended for feature testing and development workflows.
Features Added
API Configuration Modal: New modal component with Chinese UI that allows users to:
Persistent Storage: Settings are automatically saved to localStorage with key
api-base-urland persist across browser sessionsRuntime URL Switching: The axios instance dynamically updates its
baseURLwhenever the configuration changes, ensuring all API calls immediately use the new settingProgrammatic Access: Exposes
window.openApiConfigModal()function for easy access via browser consoleImplementation Details
New Files
src/lib/apiConfig.ts- Core API configuration management with reactive Vue composablessrc/components/ApiConfigModal.vue- Modal component with form interfaceModified Files
src/lib/hooks.ts- Added modal state management for the new configuration modalsrc/api/index.ts- Updated axios instance to use dynamic base URL with reactive updatessrc/App.vue- Integrated the modal component and exposed the window functionUsage Example
Technical Implementation
The feature uses Vue's composition API with reactive refs and computed properties to ensure the API configuration updates propagate immediately to all axios requests. The modal integrates seamlessly with the existing modal system used throughout the application.
Default URLs:
/server/apiprocess.env.VUE_APP_BASE_URLTesting
The implementation has been tested to ensure:
Fixes #187.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.