Embed wasm file, login on enter
This commit is contained in:
parent
51276d3831
commit
fe1556b099
@ -17,12 +17,12 @@ dependencies = ["build_client_release", "build_server_release"]
|
||||
description = "Build client"
|
||||
install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" }
|
||||
command = "wasm-pack"
|
||||
args = ["build", "app", "--target", "web", "--out-name", "app", "--dev"]
|
||||
args = ["build", "app", "--target", "web", "--out-name", "app", "--out-dir", "../pslink/static/wasm/", "--dev"]
|
||||
|
||||
[tasks.build_client_release]
|
||||
extend = "build_client"
|
||||
description = "Build client in release mode"
|
||||
args = ["build", "app", "--target", "web", "--out-name", "app", "--release"]
|
||||
args = ["build", "app", "--target", "web", "--out-name", "app", "--out-dir", "../pslink/static/wasm/", "--release"]
|
||||
|
||||
[tasks.build_server]
|
||||
env = { SQLX_OFFLINE = 1 }
|
||||
|
@ -6,6 +6,7 @@ pub mod pages;
|
||||
use pages::list_links;
|
||||
use pages::list_users;
|
||||
use seed::window;
|
||||
use seed::IF;
|
||||
use seed::{attrs, button, div, input, label, log, prelude::*, App, Url, C};
|
||||
use shared::apirequests::users::LoginUser;
|
||||
use shared::datatypes::Lang;
|
||||
@ -391,11 +392,14 @@ fn view_login(lang: &I18n, model: &Model) -> Node<Msg> {
|
||||
label![t("password")],
|
||||
input![
|
||||
input_ev(Ev::Input, |s| { Msg::PasswordChanged(s) }),
|
||||
keyboard_ev(Ev::KeyDown, |keyboard_event| {
|
||||
IF!(keyboard_event.key() == "Enter" => Msg::Login)
|
||||
}),
|
||||
attrs![
|
||||
At::Type => "password",
|
||||
At::Placeholder => t("password"),
|
||||
At::Name => "password",
|
||||
At::Value => model.login_data.password],
|
||||
At::Type => "password",
|
||||
At::Placeholder => t("password"),
|
||||
At::Name => "password",
|
||||
At::Value => model.login_data.password],
|
||||
el_ref(&model.login_form.password)
|
||||
]
|
||||
],
|
||||
|
@ -96,8 +96,8 @@ pub async fn wasm_app(config: web::Data<crate::ServerConfig>) -> Result<HttpResp
|
||||
<body>
|
||||
<section id="app"><div class="lds-ellipsis">Loading: <div></div><div></div><div></div><div></div></div></section>
|
||||
<script type="module">
|
||||
import init from '/app/pkg/app.js';
|
||||
init('/app/pkg/app_bg.wasm');
|
||||
import init from '/static/wasm/app.js';
|
||||
init('/static/wasm/app_bg.wasm');
|
||||
</script>
|
||||
</body>
|
||||
</html>"#,
|
||||
|
Loading…
Reference in New Issue
Block a user