misc_pterodactyl-panel/resources/scripts/api/server/getWebsocketToken.ts
Matthew Penner 5c5e2e24f1 📯 tRaNsFeR lOgS 📯
2020-12-17 10:35:54 -07:00

21 lines
531 B
TypeScript

import http from '@/api/http';
interface Response {
token: string;
socket: string;
}
export default (server: string, transfer: boolean): Promise<Response> => {
return new Promise((resolve, reject) => {
http.get(`/api/client/servers/${server}/websocket`, {
params: {
transfer,
},
})
.then(({ data }) => resolve({
token: data.data.token,
socket: data.data.socket,
}))
.catch(reject);
});
};