Fix javascript to handle values properly
This commit is contained in:
parent
235eb90d6e
commit
dd1b971914
|
@ -1,18 +1,20 @@
|
||||||
import init, { open_invite, set_panic_hook } from "./pkg/lox_wasm.js";
|
import init, { open_invite, set_panic_hook } from "./pkg/lox_wasm.js";
|
||||||
var pubkeys = request_pubkeys().then((pubkeys) => {
|
let pubkeys = await request_pubkeys();
|
||||||
pubkeys
|
console.log(pubkeys);
|
||||||
});
|
|
||||||
console.log(pubkeys)
|
|
||||||
init().then(() => {
|
let requested = await init().then(() => {
|
||||||
set_panic_hook();
|
set_panic_hook();
|
||||||
requested = request_open_invite().then((token) => {
|
let requested = request_open_invite().then((token) => {
|
||||||
open_invite(token);
|
return open_invite(token);
|
||||||
});
|
});
|
||||||
|
return requested;
|
||||||
// unsigned_open_lox_credential = handle_new_lox_credential(requested, pubkeys);
|
// unsigned_open_lox_credential = handle_new_lox_credential(requested, pubkeys);
|
||||||
// lox_credential = request_new_lox_credential(request_cred[0]).then((lox_cred) => {
|
// lox_credential = request_new_lox_credential(request_cred[0]).then((lox_cred) => {
|
||||||
// handle_new_lox_credential(request_cred[1], response, pubkey);
|
// handle_new_lox_credential(request_cred[1], response, pubkey);
|
||||||
// })
|
// })
|
||||||
});
|
});
|
||||||
|
console.log("Got request and state "+requested);
|
||||||
|
|
||||||
function request_open_invite() {
|
function request_open_invite() {
|
||||||
return new Promise((fulfill, reject) => {
|
return new Promise((fulfill, reject) => {
|
||||||
|
|
|
@ -56,7 +56,7 @@ fn deconcat_string(concatString: String) -> (String, String) {
|
||||||
|
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn handle_new_lox_credential(open_lox_result: String, lox_pub: String) -> Result<String, JsValue> {
|
pub fn handle_new_lox_credential(open_lox_result: String, open_lox_response: String, lox_pub: String) -> Result<String, JsValue> {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(&format!("Using server response: {:?}", open_lox_result));
|
log(&format!("Using server response: {:?}", open_lox_result));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue