workadventure/front/src/register.ts
2020-09-17 18:21:49 +02:00

12 lines
371 B
TypeScript

import Axios from "axios";
import {API_URL} from "./Enum/EnvironmentVariable";
declare let window:Window;
export function redirectIfToken() {
const match = window.location.toString().match(/\/register\/(.+)/);
if (match) {
Axios.get(`${API_URL}/register/`+match[1]).then((res) => {
window.location = res.data.loginUrl;
});
}
}