2020-11-09 02:09:22 +00:00
|
|
|
import { rawDataToServerDatabase, ServerDatabase } from '@/api/server/databases/getServerDatabases';
|
2019-07-17 04:43:11 +00:00
|
|
|
import http from '@/api/http';
|
|
|
|
|
|
|
|
export default (uuid: string, data: { connectionsFrom: string; databaseName: string }): Promise<ServerDatabase> => {
|
|
|
|
return new Promise((resolve, reject) => {
|
2022-06-26 19:13:52 +00:00
|
|
|
http.post(
|
|
|
|
`/api/client/servers/${uuid}/databases`,
|
|
|
|
{
|
|
|
|
database: data.databaseName,
|
|
|
|
remote: data.connectionsFrom,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
params: { include: 'password' },
|
2022-11-25 20:25:03 +00:00
|
|
|
},
|
2022-06-26 19:13:52 +00:00
|
|
|
)
|
2022-11-25 20:25:03 +00:00
|
|
|
.then(response => resolve(rawDataToServerDatabase(response.data.attributes)))
|
2019-07-17 04:43:11 +00:00
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|