mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Global username instead of per room (#1382)
* global username * remove string interpolation Co-Authored-By: Lipis <lipiridis@gmail.com> * remove string interpolation Co-Authored-By: Lipis <lipiridis@gmail.com> * remove backwards compat Co-authored-by: Lipis <lipiridis@gmail.com>
This commit is contained in:
parent
166ad0412c
commit
2adae4132b
2 changed files with 8 additions and 10 deletions
|
@ -244,9 +244,7 @@ export class App extends React.Component<any, AppState> {
|
|||
onRoomCreate={this.openPortal}
|
||||
onRoomDestroy={this.closePortal}
|
||||
onUsernameChange={(username) => {
|
||||
if (this.portal.socket && this.portal.roomID && username) {
|
||||
saveUsernameToLocalStorage(this.portal.roomID, username);
|
||||
}
|
||||
saveUsernameToLocalStorage(username);
|
||||
this.setState({
|
||||
username,
|
||||
});
|
||||
|
@ -921,12 +919,12 @@ export class App extends React.Component<any, AppState> {
|
|||
);
|
||||
|
||||
this.portal.socket!.on("init-room", () => {
|
||||
if (this.portal.socket && this.portal.roomID) {
|
||||
const username = restoreUsernameFromLocalStorage(this.portal.roomID);
|
||||
if (this.portal.socket) {
|
||||
const username = restoreUsernameFromLocalStorage();
|
||||
|
||||
this.portal.socket.emit("join-room", this.portal.roomID);
|
||||
|
||||
if (username) {
|
||||
if (username !== null) {
|
||||
this.setState({
|
||||
username,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue