2019-09-09 00:48:37 +00:00
|
|
|
import http from '@/api/http';
|
|
|
|
|
2019-09-25 03:20:29 +00:00
|
|
|
interface Response {
|
|
|
|
token: string;
|
|
|
|
socket: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default (server: string): Promise<Response> => {
|
2019-09-09 00:48:37 +00:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
http.get(`/api/client/servers/${server}/websocket`)
|
2022-06-26 19:13:52 +00:00
|
|
|
.then(({ data }) =>
|
|
|
|
resolve({
|
|
|
|
token: data.data.token,
|
|
|
|
socket: data.data.socket,
|
|
|
|
})
|
|
|
|
)
|
2019-09-09 00:48:37 +00:00
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|