misc passkey prep
This commit is contained in:
@@ -15,7 +15,7 @@ tonic = { version = "*", default-features = false, features = [
|
|||||||
] }
|
] }
|
||||||
prost = "0.13"
|
prost = "0.13"
|
||||||
tonic-web-wasm-client = "0.7"
|
tonic-web-wasm-client = "0.7"
|
||||||
web-sys = { version = "0.3.91", features = ["Storage", "Window"] }
|
web-sys = { version = "0.3.91", features = ["Storage", "Window", "Navigator", "CredentialsContainer", "CredentialCreationOptions"] }
|
||||||
dioxus-primitives = { git = "https://github.com/DioxusLabs/components", version = "0.0.1", default-features = false }
|
dioxus-primitives = { git = "https://github.com/DioxusLabs/components", version = "0.0.1", default-features = false }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|||||||
@@ -1,27 +1,36 @@
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
use web_sys::{CredentialCreationOptions, window};
|
||||||
|
|
||||||
use crate::components::basic::Button;
|
use crate::components::basic::Button;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn PasskeyRegistrationButton() -> Element
|
pub fn PasskeyRegistrationButton() -> Element {
|
||||||
{
|
|
||||||
rsx! {
|
rsx! {
|
||||||
Button{
|
Button{
|
||||||
text: "Register Passkey",
|
text: "Register Passkey",
|
||||||
onclick: move |e| {
|
onclick: move |_| {
|
||||||
|
start_passkey_registration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_passkey_registration() {}
|
fn start_passkey_registration() {
|
||||||
|
create_credential();
|
||||||
|
}
|
||||||
|
|
||||||
fn create_credential() {}
|
fn create_credential() {
|
||||||
|
let credentials = window()
|
||||||
|
.expect("Failed to get window")
|
||||||
|
.navigator()
|
||||||
|
.credentials();
|
||||||
|
|
||||||
|
let opts = CredentialCreationOptions::new();
|
||||||
|
let _result = credentials.create_with_options(&opts);
|
||||||
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn PasskeyLoginButton() -> Element
|
pub fn PasskeyLoginButton() -> Element {
|
||||||
{
|
|
||||||
rsx! {
|
rsx! {
|
||||||
Button{
|
Button{
|
||||||
text: "Login with Passkey"
|
text: "Login with Passkey"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ pub fn Media(id: String) -> Element {
|
|||||||
#[component]
|
#[component]
|
||||||
fn MediaPage(media: MediaModel) -> Element {
|
fn MediaPage(media: MediaModel) -> Element {
|
||||||
let url = media.thumb_url;
|
let url = media.thumb_url;
|
||||||
let id = media.id.expect("Media has no id").value.clone();
|
// let id = media.id.expect("Media has no id").value.clone();
|
||||||
let cur_class = use_signal(|| match media.class {
|
let cur_class = use_signal(|| match media.class {
|
||||||
0 => "Standard",
|
0 => "Standard",
|
||||||
1 => "NSFW",
|
1 => "NSFW",
|
||||||
|
|||||||
Reference in New Issue
Block a user