feat: initialize backend database service architecture and implement frontend schema explorer components
This commit is contained in:
@@ -6,7 +6,7 @@ const api = axios.create({
|
||||
});
|
||||
|
||||
api.interceptors.request.use((config) => {
|
||||
const connection = useAppStore.getState().connection;
|
||||
const { connection, activeDatabase } = useAppStore.getState();
|
||||
if (connection) {
|
||||
config.params = {
|
||||
...config.params,
|
||||
@@ -14,7 +14,7 @@ api.interceptors.request.use((config) => {
|
||||
username: connection.username,
|
||||
password: connection.password,
|
||||
port: connection.port,
|
||||
database: connection.database || config.params?.database,
|
||||
database: config.params?.database || activeDatabase || connection.database,
|
||||
};
|
||||
}
|
||||
return config;
|
||||
@@ -24,7 +24,7 @@ export default api;
|
||||
|
||||
export const SchemaService = {
|
||||
getDatabases: () => api.get('/schema/databases'),
|
||||
getTables: (db: string) => api.get(`/schema/tables/${db}`),
|
||||
getTableSchema: (table: string) => api.get(`/schema/${table}`),
|
||||
getTableData: (table: string, database?: string) => api.get(`/schema/${table}/data`, { params: { database } }),
|
||||
getTables: (db: string) => api.get(`/schema/tables/${db}`, { params: { database: db } }),
|
||||
getTableSchema: (table: string, database?: string) => api.get(`/schema/${table}`, { params: { database } }),
|
||||
getTableData: (table: string, params: any) => api.get(`/schema/${table}/data`, { params }),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user