pass the access token to the DGT TS
parent
3ecfe50de9
commit
b2fa70ad4c
|
@ -32,9 +32,9 @@ final class DgtCtrl(env: Env) extends LilaController(env) {
|
|||
|
||||
def play =
|
||||
Auth { implicit ctx => me =>
|
||||
findToken(me) map { t =>
|
||||
if (t.isEmpty) Redirect(routes.DgtCtrl.config())
|
||||
else Ok(views.html.dgt.play)
|
||||
findToken(me) map {
|
||||
case None => Redirect(routes.DgtCtrl.config())
|
||||
case Some(t) => Ok(views.html.dgt.play(t))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import scala.util.chaining._
|
|||
import lila.api.Context
|
||||
import lila.app.templating.Environment._
|
||||
import lila.app.ui.ScalatagsTemplate._
|
||||
import lila.oauth.AccessToken
|
||||
|
||||
object dgt {
|
||||
|
||||
|
@ -44,8 +45,8 @@ object dgt {
|
|||
)
|
||||
)
|
||||
|
||||
def play(implicit ctx: Context) =
|
||||
layout("play", embedJsUnsafeLoadThen("lichessDgt.playPage()"))(
|
||||
def play(token: AccessToken)(implicit ctx: Context) =
|
||||
layout("play", embedJsUnsafeLoadThen(s"""lichessDgt.playPage("${token.id.value}")"""))(
|
||||
h1("DGT - play"),
|
||||
div(id := "dgt-play-zone")("Do the thing here.")
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default function() {
|
||||
export default function(token: string) {
|
||||
// here's the new setting keys
|
||||
[
|
||||
'dgt-livechess-url',
|
||||
|
@ -12,7 +12,8 @@ export default function() {
|
|||
});
|
||||
|
||||
// put your UI in there
|
||||
const root = document.getElementById('dgt-play-zone');
|
||||
const root = document.getElementById('dgt-play-zone') as HTMLDivElement;
|
||||
|
||||
// and your code in here.
|
||||
root.innerHTML = 'token: ' + token
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue