Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: change function name
Browse files Browse the repository at this point in the history
Nomandes committed Jan 8, 2024
1 parent 362c1f1 commit 0ced54e
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/frontend/src/common/dialogs/JoinSessionDialog.tsx
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ export function JoinSessionDialog({ onAddToWaitingList }: JoinSessionDialogProps
handleChange,
isValid,
} = useValidatedTextInput({ minLength: 1, maxLength: 40 });
const { isStorageAllowed, saveNameLocally, handleAllowanceChange } = useLocalStorageName({
const { isStorageAllowed, trySavingNameLocally, handleAllowanceChange } = useLocalStorageName({
setName,
});
const { redirectBackToHome, redirectToRoom } = useRedirect();
@@ -76,7 +76,7 @@ export function JoinSessionDialog({ onAddToWaitingList }: JoinSessionDialogProps
};
setRoomId(roomId);
setUser(newUser);
saveNameLocally(name);
trySavingNameLocally(name);
onAddToWaitingList({ userId: newUser.id, userName: name });
redirectToRoom(roomId);
handleClose();
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ export function CreateRetroSessionDialog() {
const { retroState, handleChangeRetroFormat, handleSetRetroState, handleJoinSession } =
useRetroContext();
const { user, setUser } = useUserContext();
const { isStorageAllowed, saveNameLocally, handleAllowanceChange } = useLocalStorageName({
const { isStorageAllowed, trySavingNameLocally, handleAllowanceChange } = useLocalStorageName({
setName,
});
const { setRoomId } = useRoomContext();
@@ -81,7 +81,7 @@ export function CreateRetroSessionDialog() {
setRoomId(roomId);
handleSetRetroState({ ...retroState, title });
setUser(newUser);
saveNameLocally(name);
trySavingNameLocally(name);
handleJoinSession(newUser);
handleChangeRetroFormat(format);
redirectToRoom(roomId);
6 changes: 3 additions & 3 deletions packages/frontend/src/retro/hooks/useLocalStorageName.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useLocalStorage } from "../../common/hooks/useLocalStorage";
import { useState } from "react";
import { LocalStorage } from "../../common/utils/localStorage";
import { useLocalStorage } from "../../common/hooks/useLocalStorage";

interface useLocalStorageNameProps {
setName: (name: string) => void;
@@ -13,7 +13,7 @@ export default function useLocalStorageName({ setName }: useLocalStorageNameProp
setIsStorageAllowed(LocalStorage.getNameStorePermission());
});

function saveNameLocally(name: string) {
function trySavingNameLocally(name: string) {
if (isStorageAllowed) {
LocalStorage.setUserName(name);
}
@@ -27,5 +27,5 @@ export default function useLocalStorageName({ setName }: useLocalStorageNameProp
setIsStorageAllowed(isAllowed);
}

return { isStorageAllowed, saveNameLocally, handleAllowanceChange };
return { isStorageAllowed, trySavingNameLocally, handleAllowanceChange };
}

0 comments on commit 0ced54e

Please sign in to comment.