~demindiro/werewolves

98941233cdc45cf7bcf9b6da58633edc21fb5272 — David Hoppenbrouwers 1 year, 9 months ago 64af8b8
Redirect user on successful game creation
1 files changed, 4 insertions(+), 4 deletions(-)

M templates/index.html
M templates/index.html => templates/index.html +4 -4
@@ 98,10 98,10 @@
		function createGame() {
			let data = { name: getField("index", "name").value }
			requestPost("{{ url_for('api.create_game') }}", data, function(e) {
				let code = JSON.parse(e.target.response)["code"]
				history.pushState(null, "", "/" + code + "/")
				setVisible("index", false)
				setVisible("game", true)
				if (e.target.status === 201) {
					window.location.href = "{{ url_for('index', code='__code') }}"
							.replace("__code", code)
				}
			})
		}