mirror of
https://github.com/wassname/talk.git
synced 2026-07-25 13:30:59 +08:00
[next] Start a clean session when user logs in / out (#1853)
* Clear user session after login / logout * Filename cases * Improve type checking * Apply suggestions
This commit is contained in:
@@ -3,12 +3,9 @@ import { Environment, ROOT_ID } from "relay-runtime";
|
||||
export default function getMe(environment: Environment) {
|
||||
const source = environment.getStore().getSource();
|
||||
const root = source.get(ROOT_ID)!;
|
||||
const meKey = Object.keys(root)
|
||||
.reverse()
|
||||
.find(s => s.startsWith("me("))!;
|
||||
if (!root[meKey]) {
|
||||
if (!root.me) {
|
||||
return null;
|
||||
}
|
||||
const meID = root[meKey].__ref;
|
||||
const meID = root.me.__ref;
|
||||
return source.get(meID)!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user