Compare commits
No commits in common. "abad7e2b40cfbac97795a19cb1773cc8197871ea" and "706e5ed07ebda5367353e8092793826caec46f78" have entirely different histories.
abad7e2b40
...
706e5ed07e
@ -63,7 +63,7 @@ pub fn App() -> impl IntoView {
|
||||
<Routes>
|
||||
<Route path="/" view=move || {
|
||||
view! {
|
||||
// only show the outlet if the signin was successfull
|
||||
// only show the outlet if data have loaded
|
||||
<Show when=move || websocket.authenticated.get() fallback=login::Login>
|
||||
<Outlet/>
|
||||
</Show>
|
||||
|
@ -73,13 +73,11 @@ impl SurrealContext {
|
||||
}
|
||||
}
|
||||
|
||||
/// Send a string to surrealDB
|
||||
#[inline(always)]
|
||||
pub fn send(&self, message: &str) {
|
||||
(self.send)(message)
|
||||
}
|
||||
|
||||
/// sigin SurrealDB
|
||||
pub fn signin(&self, pass: String) {
|
||||
log::debug!("Signing into surrealdb");
|
||||
|
||||
@ -97,7 +95,6 @@ impl SurrealContext {
|
||||
}
|
||||
|
||||
pub fn init_surrealdb() {
|
||||
// Initialize a connection to surrealDB
|
||||
let UseWebsocketReturn {
|
||||
ready_state,
|
||||
message,
|
||||
@ -105,11 +102,9 @@ pub fn init_surrealdb() {
|
||||
..
|
||||
} = use_websocket("ws://localhost:80/rpc");
|
||||
|
||||
// Create reactive signals for the websocket connection to surrealDB
|
||||
let (participants, _set_participants) = create_signal::<Vec<Participant>>(vec![]);
|
||||
let (authenticated, set_authenticated) = create_signal::<bool>(false);
|
||||
|
||||
// Bind the websocket connection to a context
|
||||
let websocket = SurrealContext::new(
|
||||
message,
|
||||
Rc::new(send.clone()),
|
||||
@ -121,7 +116,6 @@ pub fn init_surrealdb() {
|
||||
provide_context(websocket);
|
||||
provide_context(ParticipantsContext(participants));
|
||||
|
||||
// Watch for a message recieved from the surrealDB connection
|
||||
create_effect(move |prev_value| {
|
||||
let msg = message.get();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user