misc_pterodactyl-panel/resources/scripts/api/server/getWebsocketToken.ts

20 lines
478 B
TypeScript
Raw Normal View History

import http from '@/api/http';
interface Response {
token: string;
socket: string;
}
export default (server: string): Promise<Response> => {
return new Promise((resolve, reject) => {
http.get(`/api/client/servers/${server}/websocket`)
.then(({ data }) =>
resolve({
token: data.data.token,
socket: data.data.socket,
2022-11-25 20:25:03 +00:00
}),
)
.catch(reject);
});
};