Added toast function for creating toast notifications #9

Merged
xeovalyte merged 3 commits from toast-notification into main 2024-03-12 16:29:06 +01:00
Showing only changes of commit 6098b7460b - Show all commits

View File

@ -1,3 +1,4 @@
use crate::util;
use leptos::*; use leptos::*;
use leptos_use::{core::ConnectionReadyState, use_websocket, UseWebsocketReturn}; use leptos_use::{core::ConnectionReadyState, use_websocket, UseWebsocketReturn};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -158,6 +159,11 @@ fn surrealdb_response(response: String) {
/// Function to execute when DB signin is succesful /// Function to execute when DB signin is succesful
fn use_surrealdb(_response: SurrealResponse) { fn use_surrealdb(_response: SurrealResponse) {
util::toast::add_toast(
"Succesfully signed into DB".to_string(),
"success".to_string(),
);
let websocket = expect_context::<SurrealContext>(); let websocket = expect_context::<SurrealContext>();
websocket.set_authenticated.set(true); websocket.set_authenticated.set(true);