workadventure/front/src/register.ts

12 lines
371 B
TypeScript
Raw Normal View History

2020-09-17 18:08:20 +02:00
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;
});
}
}