Skip to content

Commit

Permalink
Merge pull request #280 from SWM-FIRE/FIRE-781-로그인이-필요합니다-대신-로그인창-띄우기
Browse files Browse the repository at this point in the history
FIRE-781 add login modal when not login
  • Loading branch information
071yoon authored Oct 25, 2022
2 parents 18db410 + 8251c5f commit c6ec970
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/components/main/TitleContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import styled from 'styled-components';
import media from 'src/styles/media';
import toast from 'react-hot-toast';
import mainModalStore from 'src/stores/mainModalStore';
import vectors from '../atoms/Vectors';
import Search from './Search';
import PositionInterface from '../../interface/position.interface';

export default function TitleContainer() {
const { openLoginModal } = mainModalStore();
const randomEnter = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
toast.error('로그인 후 입장 가능합니다.');
openLoginModal();
};

return (
Expand Down
4 changes: 3 additions & 1 deletion src/components/main/block/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useNavigate } from 'react-router-dom';
import { isMobile } from 'react-device-detect';
import styled from 'styled-components';
import media from 'src/styles/media';
import mainModalStore from 'src/stores/mainModalStore';
import UserStore from '../../../stores/userStore';
import MyAvatar from '../../../assets/avatar/MyAvatar';
import RoomDetail from '../../atoms/RoomDetail';
Expand All @@ -14,11 +15,12 @@ export default function Block({ isMain, data }) {
const navigate = useNavigate();
const { nickname } = UserStore();
const { enterProfile } = useEnterProfile(data?.moderator.uid);
const { openLoginModal } = mainModalStore();

const enterRoom = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
if (!nickname) {
toast.error('로그인이 필요합니다');
openLoginModal();
return;
}
if (isMobile) {
Expand Down

0 comments on commit c6ec970

Please sign in to comment.