Skip to content

Commit

Permalink
formatted with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiral-Memory committed Feb 17, 2024
1 parent 6050c75 commit d49f6d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
21 changes: 9 additions & 12 deletions packages/api/src/EmbeddedChatApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,18 +445,15 @@ export default class EmbeddedChatApi {

async permissionInfo() {
try {
const { userId, authToken } = await this.auth.getCurrentUser() || {};
const response = await fetch(
`${this.host}/api/v1/permissions.listAll`,
{
headers: {
'Content-Type': 'application/json',
'X-Auth-Token': authToken,
'X-User-Id': userId,
},
method: 'GET',
}
);
const { userId, authToken } = (await this.auth.getCurrentUser()) || {};
const response = await fetch(`${this.host}/api/v1/permissions.listAll`, {
headers: {
"Content-Type": "application/json",
"X-Auth-Token": authToken,
"X-User-Id": userId,
},
method: "GET",
});
return await response.json();
} catch (err) {
console.error(err);
Expand Down
10 changes: 8 additions & 2 deletions packages/react/src/components/ChatInput/ChatInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ChatInput = ({ scrollToBottom }) => {
const isUserAuthenticated = useUserStore(
(state) => state.isUserAuthenticated
);
const canSendMsg = useUserStore((state)=>state.canSendMsg);
const canSendMsg = useUserStore((state) => state.canSendMsg);

const setIsUserAuthenticated = useUserStore(
(state) => state.setIsUserAuthenticated
Expand Down Expand Up @@ -461,7 +461,13 @@ const ChatInput = ({ scrollToBottom }) => {
<textarea
rows={1}
disabled={!isUserAuthenticated || !canSendMsg || isRecordingMessage}
placeholder={isUserAuthenticated && canSendMsg? 'Message' : isUserAuthenticated ? 'This room is read only' : 'Sign in to chat'}
placeholder={
isUserAuthenticated && canSendMsg
? 'Message'
: isUserAuthenticated
? 'This room is read only'
: 'Sign in to chat'
}
className={styles.textInput}
onChange={onTextChange}
onKeyUp={showCommands}
Expand Down
3 changes: 1 addition & 2 deletions packages/react/src/store/userStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ const useUserStore = create((set) => ({
canSendMsg: true,
setIsUserAuthenticated: (isUserAuthenticated) =>
set(() => ({ isUserAuthenticated })),
setCanSendMsg: (canSendMsg) =>
set(() => ({ canSendMsg })),
setCanSendMsg: (canSendMsg) => set(() => ({ canSendMsg })),
password: null,
setPassword: (password) => set(() => ({ password })),
emailoruser: null,
Expand Down

0 comments on commit d49f6d6

Please sign in to comment.