mirror of
https://github.com/thelounge/thelounge.git
synced 2026-03-14 14:35:50 +01:00
server: somewhat type fix auth related functions
The auth functions are a bloody mess and need to be cleaned up. using various callback functions and using variables as pointers makes the logic hard to follow and hence idiotic to type too, as multiple orthogonal logic paths are mixed up into one function. This really needs to be untangled
This commit is contained in:
parent
5001d607b1
commit
e61e356f1e
2 changed files with 70 additions and 28 deletions
22
shared/types/socket-events.d.ts
vendored
22
shared/types/socket-events.d.ts
vendored
|
|
@ -101,17 +101,19 @@ interface ServerToClientEvents {
|
|||
}>;
|
||||
}
|
||||
|
||||
type AuthPerformData =
|
||||
| Record<string, never> // funny way of saying an empty object
|
||||
| {user: string; password: string}
|
||||
| {
|
||||
user: string;
|
||||
token: string;
|
||||
lastMessage: number;
|
||||
openChannel: number | null;
|
||||
hasConfig: boolean;
|
||||
};
|
||||
|
||||
interface ClientToServerEvents {
|
||||
"auth:perform": EventHandler<
|
||||
| {user: string; password: string}
|
||||
| {
|
||||
user: string;
|
||||
token: string;
|
||||
lastMessage: number;
|
||||
openChannel: number | null;
|
||||
hasConfig: boolean;
|
||||
}
|
||||
>;
|
||||
"auth:perform": EventHandler<AuthPerformData>;
|
||||
|
||||
changelog: NoPayloadEventHandler;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue