Finish support for creating databases in the UI
This commit is contained in:
parent
61dc86421d
commit
1f763dc155
7 changed files with 136 additions and 12 deletions
15
resources/scripts/api/server/createServerDatabase.ts
Normal file
15
resources/scripts/api/server/createServerDatabase.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { rawDataToServerDatabase, ServerDatabase } from '@/api/server/getServerDatabases';
|
||||
import http from '@/api/http';
|
||||
|
||||
export default (uuid: string, data: { connectionsFrom: string; databaseName: string }): Promise<ServerDatabase> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.post(`/api/client/servers/${uuid}/databases`, {
|
||||
database: data.databaseName,
|
||||
remote: data.connectionsFrom,
|
||||
}, {
|
||||
params: { include: 'password' },
|
||||
})
|
||||
.then(response => resolve(rawDataToServerDatabase(response.data.attributes)))
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
Reference in a new issue