Fixed logout not working
This commit is contained in:
parent
570edc1b44
commit
a0fb083922
@ -14,4 +14,6 @@ services:
|
|||||||
- "root"
|
- "root"
|
||||||
- --pass
|
- --pass
|
||||||
- "root"
|
- "root"
|
||||||
|
- --log
|
||||||
|
- debug
|
||||||
- rocksdb:/data/database.db
|
- rocksdb:/data/database.db
|
||||||
|
@ -3,6 +3,8 @@ use crate::util::surrealdb::{thing_to_string, DB};
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
#[cfg(feature = "server")]
|
||||||
|
use surrealdb::sql::Thing;
|
||||||
|
|
||||||
use super::user::User;
|
use super::user::User;
|
||||||
|
|
||||||
@ -114,10 +116,10 @@ impl Session {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delete_session(user_id: String) -> Result<(), crate::Error> {
|
pub async fn delete_session(session_token: String) -> Result<(), crate::Error> {
|
||||||
let res = DB
|
let res = DB
|
||||||
.query("DELETE ONLY session WHERE user = type::thing('user', $user_id)")
|
.query("DELETE session WHERE token = $session_token")
|
||||||
.bind(("user_id", user_id))
|
.bind(("session_token", session_token))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
res.check()?;
|
res.check()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user