feat: show post box only after login
This commit is contained in:
parent
f733d42af7
commit
5f46de0fc9
2 changed files with 18 additions and 22 deletions
|
@ -31,10 +31,9 @@ pub fn LoginBox(
|
|||
} />
|
||||
</div>
|
||||
<div class:hidden=move || { !rx.get().unwrap_or_default().is_empty() }>
|
||||
<p>
|
||||
<input type="text" node_ref=username_ref placeholder="username" />
|
||||
<input type="text" node_ref=password_ref placeholder="password" />
|
||||
<input type="submit" value="login" on:click=move |_| {
|
||||
<input class="w-100" type="text" node_ref=username_ref placeholder="username" />
|
||||
<input class="w-100" type="text" node_ref=password_ref placeholder="password" />
|
||||
<input class="w-100" type="submit" value="login" on:click=move |_| {
|
||||
console_log("logging in...");
|
||||
let email = username_ref.get().map(|x| x.value()).unwrap_or("".into());
|
||||
let password = password_ref.get().map(|x| x.value()).unwrap_or("".into());
|
||||
|
@ -49,7 +48,6 @@ pub fn LoginBox(
|
|||
tx.set(Some(auth));
|
||||
});
|
||||
} />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
@ -60,7 +58,7 @@ pub fn PostBox(token: Signal<Option<String>>) -> impl IntoView {
|
|||
let summary_ref: NodeRef<html::Input> = create_node_ref();
|
||||
let content_ref: NodeRef<html::Textarea> = create_node_ref();
|
||||
view! {
|
||||
<div>
|
||||
<div class:hidden=move || { token.get().unwrap_or_default().is_empty() }>
|
||||
<input class="w-100" type="text" node_ref=summary_ref placeholder="CW" />
|
||||
<textarea class="w-100" node_ref=content_ref placeholder="hello world!" ></textarea>
|
||||
<button class="w-100" type="button" on:click=move |_| {
|
||||
|
|
|
@ -29,9 +29,7 @@ fn main() {
|
|||
tx=set_cookie
|
||||
rx=cookie
|
||||
/>
|
||||
<hr />
|
||||
<PostBox token=cookie />
|
||||
<hr />
|
||||
</div>
|
||||
<div class="col-main">
|
||||
<Router // TODO maybe set base="/web" ?
|
||||
|
|
Loading…
Reference in a new issue