Skip to content

Commit 49e346d

Browse files
committed
migrate remaining changes
1 parent 1a08b08 commit 49e346d

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

chatapp-frontend/src/components/containers/Cards.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ export default function Cards(props) {
1111
const onlineStatus = props.online;
1212

1313
const username = user.username[0].toUpperCase() + user.username.slice(1);
14-
1514
return (
1615
<>
1716
<Card
18-
sx={{ maxWidth: 300 }}
17+
sx={{ maxWidth: 250 }}
1918
style={{
2019
padding: "10px",
2120
marginBottom: "20px",
@@ -57,7 +56,7 @@ export default function Cards(props) {
5756
<CardActions>
5857
<Link to={`/profile/${user.username}`}>
5958
<Button size="small" variant="contained">
60-
View Profile
59+
Profile
6160
</Button>
6261
</Link>
6362
<Link to={`/chat/user/${user.public_id}`}>

chatapp-frontend/src/components/containers/Containers.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function Containers() {
4242
<Grid item xs={12} ms={4} sm={4} key={idx}>
4343
<Cards
4444
user={result}
45-
online={onlineuser.includes(result.username)}
45+
online={onlineuser.includes(result.username.toLowerCase())}
4646
/>
4747
</Grid>
4848
))
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
#root{
2+
background-color: #a7bcff;
3+
height: 100vh;
4+
}
15
.homeContainer{
26
width:100%;
3-
height: calc(100vh - 50px);
47
background-color: #a7bcff;
58
}
69

chatapp-frontend/src/pages/register/Register.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function Register() {
1212

1313

1414
const handleClick = async (e) => {
15-
const newUrl = `${process.env.REACT_APP_API_URL}/auth/registration/`;
15+
const registerUrl = `${process.env.REACT_APP_BACKEND_API}/auth/registration/`;
1616
setError(null);
1717
const password_ = password.current.value;
1818
const passwordAgain_ = passwordAgain.current.value;
@@ -28,15 +28,15 @@ export default function Register() {
2828
password2: passwordAgain_,
2929
};
3030
try {
31-
await axios.post(newUrl, user, {
31+
await axios.post(registerUrl, user, {
3232
headers: {
3333
"content-type": "application/json",
3434
},
3535
});
3636
navigate("/login");
3737
} catch (err) {
3838
if(err.response.status === 400){
39-
setError("User already Exists")
39+
setError("Bad Requests")
4040
}
4141
if(err.response.status === 500){
4242
setError("Something Went Wrong!")

chatapp/consumers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, *args, **kwargs):
1717

1818
async def add_online_user(self):
1919
# adding on cache
20-
username = self.user.username
20+
username = self.user.username.lower()
2121
key = f"user_:{username}"
2222
has_key = cache.get(key)
2323
if not has_key:
@@ -47,7 +47,7 @@ async def send_online_users(self):
4747
await self.channel_layer.group_send("OnlineUser",chatMessage)
4848

4949
async def delete_online_user(self):
50-
username = self.user.username
50+
username = self.user.username.lower()
5151
key = f"user_:{username}"
5252
cache.delete(key)
5353
self.online_user.remove(username)

0 commit comments

Comments
 (0)