Skip to content

Commit

Permalink
update firebase config
Browse files Browse the repository at this point in the history
  • Loading branch information
pth-1641 committed Jul 27, 2022
1 parent e854814 commit 133369e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/components/ChatContent/Modals/ModalShowMedia.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ function ModalShowImage({ link }) {
{link.type === 'video' ? (
<video
src={link.link}
className='w-full md:h-full mx-auto rounded-lg'
className='w-full md:w-auto md:h-full mx-auto rounded-lg'
controls
autoPlay
/>
) : (
<img
src={link.link}
alt=''
className='w-full md:h-full mx-auto rounded-lg'
className='w-full md:w-auto md:h-full mx-auto rounded-lg'
/>
)}
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/components/ChatList/ChatItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ function ChatItem({ roomId }) {
style={{ backgroundColor: avatarBgColor }}
>
{chatType === 'friend' ? (
<img src={friend.photoURL} alt='' />
<img
src={friend.photoURL}
alt=''
className='w-full object-cover'
/>
) : chatAvatar ? (
<img
src={chatAvatar}
Expand Down
12 changes: 6 additions & 6 deletions src/firebase/config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
import { getStorage } from '@firebase/storage';

const firebaseConfig = {
apiKey: 'AIzaSyDmGtZyoeOoyPs3Snt5cj3m3q20qrmFd7M',
authDomain: 'messenger-3eba2.firebaseapp.com',
projectId: 'messenger-3eba2',
storageBucket: 'messenger-3eba2.appspot.com',
messagingSenderId: '466557802374',
appId: '1:466557802374:web:ff0c9d5468509603773e07',
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
appId: import.meta.env.VITE_FIREBASE_APP_ID,
};

const app = initializeApp(firebaseConfig);
Expand Down
28 changes: 13 additions & 15 deletions src/firebase/functionHandler.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ export const isCreateRoom = (member) => {
return getDocs(q);
};

// ---------------------CREATE----------------------- //
// --------------------- CREATE ----------------------- //
export const addNewUser = (userInfo) => {
const { displayName, email, phoneNumber, photoURL, uid } = userInfo;
return addDoc(collection(db, 'users'), {
...userInfo,
displayName,
email,
phoneNumber,
photoURL,
uid,
rooms: [],
});
};

Expand Down Expand Up @@ -157,20 +163,12 @@ export const removeMember = (roomId, memberInfo) => {
});
};

async function fetchData() {
const ref = doc(db, 'rooms', '17hxUeheBDT1wXKJbbo9');
return updateDoc(ref, {
rooms: arrayRemove({
displayName: 'hung',
isAdmin: false,
nickname: '',
photoURL:
'https://images.unsplash.com/photo-1657998623149-8bb43c02e20d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=464&q=80',
uid: '123',
}),
function fetchData() {
return addDoc(collection(db, 'users'), {
name: 'hung',
age: 20,
});
}

// fetchData();

// console.log(fetchData());
// fetchData();
2 changes: 1 addition & 1 deletion src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Login() {
try {
const result = await getUser(user.uid);
if (result.size === 0) {
addNewUser(user);
await addNewUser(user);
}
} catch (err) {
console.log(err);
Expand Down

1 comment on commit 133369e

@vercel
Copy link

@vercel vercel bot commented on 133369e Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

chat-app – ./

chat-app-git-main-pth-1641.vercel.app
chat-app-pth-1641.vercel.app
messenger-v02.vercel.app

Please sign in to comment.