misc_pterodactyl-panel/resources/scripts/api/server/databases/createServerDatabase.ts

20 lines
705 B
TypeScript
Raw Normal View History

import { rawDataToServerDatabase, ServerDatabase } from '@/api/server/databases/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' },
2022-11-25 20:25:03 +00:00
},
)
2022-11-25 20:25:03 +00:00
.then(response => resolve(rawDataToServerDatabase(response.data.attributes)))
.catch(reject);
});
};