diff --git a/components/cards/QrCard.js b/components/cards/QrCard.js index c0f25c3..3a52a58 100644 --- a/components/cards/QrCard.js +++ b/components/cards/QrCard.js @@ -3,10 +3,8 @@ import { View, Text, Image, ScrollView } from 'react-native'; import { useNavigation } from '@react-navigation/native'; import QRCode from 'react-native-qrcode-svg'; -import NormalButton from '../../components/buttons/NormalButton'; import { styles } from './styles/QrCard.styles'; import { colors } from '../../constants/colors'; -import { hospitalName } from '../../mocks/hospitalData'; // hasAccessAuthority: 출입 권한 여부, userVC : VC에 담을 사용자 정보, qrData : QR에 담을 JSON 문자열 const QrCard = ({ hasAccessAuthority, did, userName, hospitalName, startDate, expireDate }) => { diff --git a/components/cards/QrCards.js b/components/cards/QrCards.js index 2aeb5b8..4137f1f 100644 --- a/components/cards/QrCards.js +++ b/components/cards/QrCards.js @@ -1,4 +1,4 @@ -import React, { useRef, useState } from 'react'; +import React, { useRef, useState, useEffect } from 'react'; import { FlatList, View, Dimensions, TouchableOpacity } from 'react-native'; import QrCard from './QrCard'; import styles from './styles/QrCards.styles'; @@ -9,10 +9,19 @@ const { width } = Dimensions.get('window'); const CARD_WIDTH = width; const OVERLAP = 80; // 카드가 겹치는 정도 -const QrCards = ({ userVC, hasAccessAuthority }) => { - const [pageIndex, setPageIndex] = useState(0); +const QrCards = ({ userVC, hasAccessAuthority, initialIndex = 0 }) => { + const [pageIndex, setPageIndex] = useState(initialIndex); const flatListRef = useRef(null); + useEffect(() => { + // 초기 인덱스가 바뀌거나, userVC 길이 변화시 + if (flatListRef.current && initialIndex >= 0 && initialIndex < userVC.length) { + const offset = initialIndex * (CARD_WIDTH - OVERLAP); + flatListRef.current.scrollToOffset({ offset, animated: true }); + setPageIndex(initialIndex); + } + }, [initialIndex, userVC.length]); + // 권한 없거나 카드 데이터 없으면 안내 메시지 카드만 if (!hasAccessAuthority || !userVC || userVC.length === 0) { return ( diff --git a/mocks/MyAccessListSample.js b/mocks/MyAccessListSample.js deleted file mode 100644 index 0a39659..0000000 --- a/mocks/MyAccessListSample.js +++ /dev/null @@ -1,124 +0,0 @@ -//예시데이터 -export const MyAccessList = [ - { - hospital_name: '삼성서울병원', - accessList: [ - { - data: { - log_id: '123', - building_name: '본관', - area_name: '3층 중환자실', - visitor_category: '보호자', - expired: false, - timestamp: '2025-05-01 18:00', - validate_to: '2025-05-01 20:00', - PatientID: '123456', - requester_category: '과장', - }, - }, - { - data: { - log_id: '124', - building_name: '별관', - area_name: '2층 병동', - visitor_category: '환자', - expired: true, - timestamp: '2025-06-20 16:00', - validate_to: '2025-06-20 21:00', - PatientID: '654321', - requester_category: '간호사', - }, - }, - ], - }, - { - hospital_name: '아주대병원', - accessList: [ - { - data: { - log_id: '29002', - building_name: '본관', - area_name: '5층 병동', - visitor_category: '환자', - expired: false, - timestamp: '2025-06-10 16:00', - validate_to: '2025-06-10 21:00', - PatientID: '888888', - requester_category: '과장', - }, - }, - ], - }, - { - hospital_name: '아주대병원2', - accessList: [ - { - data: { - log_id: '29002', - building_name: '본관', - area_name: '5층 병동', - visitor_category: '환자', - expired: false, - timestamp: '2025-06-10 16:00', - validate_to: '2025-06-10 21:00', - PatientID: '888888', - requester_category: '과장', - }, - }, - ], - }, - { - hospital_name: '아주대병원3', - accessList: [ - { - data: { - log_id: '29002', - building_name: '본관', - area_name: '5층 병동', - visitor_category: '환자', - expired: false, - timestamp: '2025-06-10 16:00', - validate_to: '2025-06-10 21:00', - PatientID: '888888', - requester_category: '과장', - }, - }, - ], - }, - { - hospital_name: '아주대병원4', - accessList: [ - { - data: { - log_id: '29002', - building_name: '본관', - area_name: '5층 병동', - visitor_category: '환자', - expired: false, - timestamp: '2025-06-10 16:00', - validate_to: '2025-06-10 21:00', - PatientID: '888888', - requester_category: '과장', - }, - }, - ], - }, - { - hospital_name: '아주대병원5', - accessList: [ - { - data: { - log_id: '29002', - building_name: '본관', - area_name: '5층 병동', - visitor_category: '환자', - expired: false, - timestamp: '2025-06-10 16:00', - validate_to: '2025-06-10 21:00', - PatientID: '888888', - requester_category: '과장', - }, - }, - ], - }, -]; diff --git a/mocks/mockAccessList.js b/mocks/mockAccessList.js new file mode 100644 index 0000000..2e1515c --- /dev/null +++ b/mocks/mockAccessList.js @@ -0,0 +1,76 @@ +export const mockAccessList = [ + { + passId: 4, + memberId: 1, + hospitalId: 1, + accessAreaNames: [ + '본관 5층 내과병동 501호', + '본관 5층 내과병동 502호', + '본관 5층 내과병동 503호', + ], + visitCategory: 'PATIENT', + patientId: 9, + startedAt: '2025-05-20T06:35:05', + expiredAt: '2025-05-22T06:33:09', + }, + { + passId: 5, + memberId: 1, + hospitalId: 1, + accessAreaNames: ['신관 3층 외과병동 301호', '신관 4층 외과병동 402호'], + visitCategory: 'PATIENT', + patientId: 9, + startedAt: '2025-05-21T08:06:27', + expiredAt: '2025-05-22T08:06:00', + }, + { + passId: 6, + memberId: 1, + hospitalId: 2, + accessAreaNames: ['암센터 7층 항암치료실 701호'], + visitCategory: 'GUARDIAN', + patientId: 10, + startedAt: '2025-05-15T08:08:15', + expiredAt: '2025-05-17T08:06:54', + }, + { + passId: 7, + memberId: 1, + hospitalId: 3, + accessAreaNames: ['본관 3층 내과병동 305호', '본관 4층 외과병동 410호'], + visitCategory: 'GUARDIAN', + patientId: 10, + startedAt: '2025-05-17T08:08:15', + expiredAt: '2025-05-18T08:06:54', + }, + { + passId: 8, + memberId: 1, + hospitalId: 3, + accessAreaNames: ['소망관 3층 응급의학과 외상전용 수술실 320호'], + visitCategory: 'GUARDIAN', + patientId: 10, + startedAt: '2025-05-15T08:08:15', + expiredAt: '2025-06-16T08:06:54', + }, + { + passId: 9, + memberId: 1, + hospitalId: 3, + accessAreaNames: ['소망관 3층 응급의학과 외상전용 수술실 320호'], + visitCategory: 'GUARDIAN', + patientId: 10, + startedAt: '2025-05-15T08:08:15', + expiredAt: '2025-06-19T08:06:54', + }, + { + passId: 10, + memberId: 1, + hospitalId: 8, + accessAreaNames: ['소망관 3층 지수전용 320호'], + visitCategory: 'GUARDIAN', + patientId: 10, + startedAt: '2025-05-15T08:08:15', + expiredAt: '2025-06-19T08:06:54', + }, +]; diff --git a/modals/MyAccessDetailModal.js b/modals/MyAccessDetailModal.js index 0fa72c2..2b2cf41 100644 --- a/modals/MyAccessDetailModal.js +++ b/modals/MyAccessDetailModal.js @@ -15,6 +15,9 @@ const MyAccessDetailModal = ({ isVisible, onClose, onConfirm, data }) => { ? '내 환자' : '상대방'; + // QR 버튼 노출 조건 + const isQrAvailable = data.approval === '출입 가능'; + return ( @@ -31,8 +34,8 @@ const MyAccessDetailModal = ({ isVisible, onClose, onConfirm, data }) => { 승인 여부: {data.approval} 환자 번호: {data.patientNumber} - {relationTitle} + {relationTitle} {`김지수\t|\t010-0000-0000`} {`손민지\t|\t010-1111-1111`} @@ -42,9 +45,11 @@ const MyAccessDetailModal = ({ isVisible, onClose, onConfirm, data }) => { 닫기 - - QR - + {isQrAvailable && ( + + QR + + )} diff --git a/modals/styles/MyAccessDetailModal.styles.js b/modals/styles/MyAccessDetailModal.styles.js index 74f8436..e6efb14 100644 --- a/modals/styles/MyAccessDetailModal.styles.js +++ b/modals/styles/MyAccessDetailModal.styles.js @@ -16,19 +16,20 @@ export const styles = StyleSheet.create({ fontSize: 22, fontWeight: '600', color: colors.black, - marginTop: '7%', + marginTop: '10%', alignSelf: 'center', }, modalContentTitle: { fontSize: 17, fontWeight: '500', color: colors.black, - marginTop: '5%', + marginVertical: '5%', alignSelf: 'center', }, textContainer: { - marginTop: '3%', - marginBottom: '7%', + marginTop: '7%', + marginBottom: '5%', + gap: '3%', }, modalText: { fontSize: 17, @@ -41,7 +42,7 @@ export const styles = StyleSheet.create({ flexDirection: 'row', justifyContent: 'center', alignSelf: 'stretch', - // marginVertical: '7%', + marginVertical: '7%', gap: '5%', }, button: { diff --git a/pages/AccessRequestRolePage.js b/pages/AccessRequestRolePage.js index 5772caa..1b81bd7 100644 --- a/pages/AccessRequestRolePage.js +++ b/pages/AccessRequestRolePage.js @@ -46,6 +46,13 @@ const AccessRequestRolePage = ({ route }) => { const navigation = useNavigation(); + const navigateToHome = () => { + navigation.reset({ + index: 0, + routes: [{ name: 'MainPage' }], + }); + }; + const handlePatientButton = () => { setIsVerified(false); setVerifiedData(null); @@ -92,7 +99,7 @@ const AccessRequestRolePage = ({ route }) => { setShowSuccessAlert(false); // 메인 페이지로 이동되도록 설정 - navigation.navigate('MainPage'); + navigateToHome(); }; return ( diff --git a/pages/MainPage.js b/pages/MainPage.js index dd811f8..8e62543 100644 --- a/pages/MainPage.js +++ b/pages/MainPage.js @@ -1,183 +1,103 @@ -import { View, Text, Image } from 'react-native'; -import React, { useState } from 'react'; -import { useNavigation } from '@react-navigation/native'; +import { View, Image } from 'react-native'; +import React, { useState, useEffect } from 'react'; +import { useNavigation, useRoute } from '@react-navigation/native'; import NormalButton from '../components/buttons/NormalButton'; import { styles } from './styles/MainPage.styles'; -import QRCode from 'react-native-qrcode-svg'; -import { colors } from '../constants/colors'; import QrCards from '../components/cards/QrCards'; +import { getAccessList } from '../apis/MyAccessListApi'; +import { getHospitalList } from '../apis/AccessRequestApi'; +import { getMyInfo } from '../apis/MyPageApi'; +// 목업 데이터 +import { mockAccessList } from '../mocks/mockAccessList'; + +// TODO: 리펙토링 할 때 같은 코드는 export해서 import해서 쓰기 +// 병원 Id로 병원 이름 찾기 +function getHospitalNameByList(hospitalId, hospitalNameList) { + const hospital = hospitalNameList.find((hospital) => hospital.hospitalId === hospitalId); + return hospital ? hospital.hospitalName : `병원명 로딩 중 . . .병원: #${hospitalId}`; +} + +// 출입증 데이터로 임시 VC 생성 +function generateUserVCfromAccessList(mockAccessList, hospitalNameList, userName) { + const randomNum = Math.floor(100000 + Math.random() * 900000); + return mockAccessList.map((item, idx) => ({ + did: `did:example:${String(item.passId).padStart(16, '0')}-${randomNum}`, + passId: item.passId, + userName, + hospitalName: getHospitalNameByList(item.hospitalId, hospitalNameList), + startDate: formatDateTime(item.startedAt), + expireDate: formatDateTime(item.expiredAt), + issuedAt: Date.now(), + })); +} + +// 날짜 포맷 함수 (YYYY-MM-DD HH:mm) +const formatDateTime = (date) => { + if (!date) return ''; + const d = new Date(date); + const yyyy = d.getFullYear(); + const mm = String(d.getMonth() + 1).padStart(2, '0'); + const dd = String(d.getDate()).padStart(2, '0'); + const hh = String(d.getHours()).padStart(2, '0'); + const min = String(d.getMinutes()).padStart(2, '0'); + return `${yyyy}-${mm}-${dd} ${hh}:${min}`; +}; + +function isAccessible(startedAt, expiredAt) { + const now = new Date(); + const start = new Date(startedAt); + const end = new Date(expiredAt); + return start <= now && now <= end; +} const MainPage = () => { // 임시: 상태변수로 출입 권한 제어 const [hasAccessAuthority, setHasAccessAuthority] = useState(true); - const userVC = [ - { - did: 'did:example:123456789abcdefg01', - userName: '김엘지', - hospitalName: '강북삼성병원', - startDate: '2025-05-17T06:35:05', - expireDate: '2025-05-18T06:33:09', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg02', - userName: '김엘지', - hospitalName: '강북삼성병원', - startDate: '2025-05-15T08:06:27', - expireDate: '2025-05-17T08:06:00', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg03', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg04', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg05', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg06', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg07', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg08', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg09', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg10', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg11', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg12', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg13', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg14', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg15', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg16', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg17', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg18', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg19', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - { - did: 'did:example:123456789abcdefg20', - userName: '김엘지', - hospitalName: '건국대학교병원', - startDate: '2025-05-15T08:08:15', - expireDate: '2025-05-17T08:06:54', - issuedAt: Date.now(), - }, - // ... (이런 식으로 계속 01, 02, 03 ... 40까지 did 값을 고유하게 부여) - ]; // 임시: QR에 담을 JSON 문자열 //const qrData = JSON.stringify(userVC); + const [hospitalNameList, setHospitalNameList] = useState([]); + const [myAccessList, setMyAccessList] = useState([]); + const [userVC, setUserVC] = useState([]); + const [userName, setUserName] = useState(''); + const navigation = useNavigation(); + const route = useRoute(); + + // initialPassId를 route에서 꺼냄 + const initialPassId = route?.params?.passId; + + // userVC가 바뀔 때마다 initialIndex 계산 + const initialIndex = + userVC && initialPassId + ? userVC.findIndex((vc) => String(vc.passId) === String(initialPassId)) + : 0; + + // 병원, 출입증 데이터 불러오기 + useEffect(() => { + // 병원 목록 불러오기 + getHospitalList().then(setHospitalNameList); + getMyInfo().then((data) => { + setUserName(data.name); // 이름 저장 + }); + // 출입증 목록 불러오기 + //getAccessList().then(setMyAccessList); + // 목업 출입증 데이터 불러오기 + setMyAccessList(mockAccessList); + }, []); + + // hospitalNameList, myAccessList 준비되면 userVC 생성 + useEffect(() => { + if (hospitalNameList.length > 0 && myAccessList.length > 0 && userName) { + // 출입 가능한 리스트 + const accessibleList = myAccessList.filter((item) => + isAccessible(item.startedAt, item.expiredAt), + ); + setUserVC(generateUserVCfromAccessList(accessibleList, hospitalNameList, userName)); + setHasAccessAuthority(accessibleList.length > 0); + } + }, [hospitalNameList, myAccessList, userName]); const navigateToAccessList = () => { navigation.navigate('AccessListPage'); @@ -194,7 +114,11 @@ const MainPage = () => { source={require('../assets/images/logoGreen.png')} resizeMode="contain" // 이미지 비율 유지 /> - + = 0 ? initialIndex : 0} // 처음 보여줄 카드 인덱스 + /> diff --git a/pages/MyAccessListPage.js b/pages/MyAccessListPage.js index e89787a..0a6a5d8 100644 --- a/pages/MyAccessListPage.js +++ b/pages/MyAccessListPage.js @@ -1,71 +1,23 @@ import React, { useEffect, useState } from 'react'; import { View, Text } from 'react-native'; +import { useNavigation } from '@react-navigation/native'; import NormalListDeep from '../components/lists/NormalListDeep'; import { styles } from './styles/MyAccessListPage.styles'; import { getAccessList } from '../apis/MyAccessListApi'; import { getHospitalList } from '../apis/AccessRequestApi'; import MyAccessDetailModal from '../modals/MyAccessDetailModal'; import { useAuthStore } from '../stores/authStore'; +// 목업 데이터 +import { mockAccessList } from '../mocks/mockAccessList'; -// 더미 데이터 (로컬 테스트 용) -const mockAccessList = [ - { - passId: 4, - memberId: 1, - hospitalId: 1, - accessAreaNames: [ - '본관 5층 내과병동 501호', - '본관 5층 내과병동 502호', - '본관 5층 내과병동 503호', - ], - visitCategory: 'PATIENT', - patientId: 9, - startedAt: '2025-05-16T06:35:05', - expiredAt: '2025-05-18T06:33:09', - }, - { - passId: 5, - memberId: 1, - hospitalId: 1, - accessAreaNames: ['신관 3층 외과병동 301호', '신관 4층 외과병동 402호'], - visitCategory: 'PATIENT', - patientId: 9, - startedAt: '2025-05-15T08:06:27', - expiredAt: '2025-05-17T08:06:00', - }, - { - passId: 6, - memberId: 1, - hospitalId: 2, - accessAreaNames: ['암센터 7층 항암치료실 701호'], - visitCategory: 'GUARDIAN', - patientId: 10, - startedAt: '2025-05-15T08:08:15', - expiredAt: '2025-05-17T08:06:54', - }, - { - passId: 7, - memberId: 1, - hospitalId: 3, - accessAreaNames: ['본관 3층 내과병동 305호', '본관 4층 외과병동 410호'], - visitCategory: 'GUARDIAN', - patientId: 10, - startedAt: '2025-05-17T08:08:15', - expiredAt: '2025-05-18T08:06:54', - }, - // { - // passId: 8, - // memberId: 1, - // hospitalId: 3, - // accessAreaNames: ['소망관 3층 응급의학과 외상전용 수술실 320호'], - // visitCategory: 'GUARDIAN', - // patientId: 10, - // startedAt: '2025-05-15T08:08:15', - // expiredAt: '2025-06-16T08:06:54', - // }, -]; +//병원 Id로 병원 이름 찾기 +function getHospitalNameByList(hospitalId, hospitalNameList) { + const hospital = hospitalNameList.find((hospital) => hospital.hospitalId === hospitalId); + return hospital ? hospital.hospitalName : `병원명 로딩 중 . . .병원: #${hospitalId}`; +} const MyAccessListPage = () => { + const navigation = useNavigation(); const { setLoading } = useAuthStore(); const [myAccessList, setMyAccessList] = useState([]); const [hospitalNameList, setHospitalNameList] = useState([]); @@ -80,7 +32,7 @@ const MyAccessListPage = () => { setLoading(true); try { const data = await getHospitalList(); - setHospitalNameList(data); // [{ hospitalId, hospitalName }] + setHospitalNameList(data); } catch (error) { console.error('병원 목록 불러오기 실패:', error); } finally { @@ -109,7 +61,7 @@ const MyAccessListPage = () => { // 임시 데이터 적용 useEffect(() => { - setMyAccessList(mockAccessList); // 위에서 만든 mock 데이터로 대체 + setMyAccessList(mockAccessList); }, []); // 출입 권한 클릭 시 모달 띄우기 @@ -126,6 +78,7 @@ const MyAccessListPage = () => { approval: getApprovalStatus(access.startedAt, access.expiredAt), patientNumber: access.patientId, issuer: access.memberId, + passId: access.passId, }); setShowModal(true); @@ -171,14 +124,10 @@ const MyAccessListPage = () => { }; //병원 Id로 병원 이름 찾기 - const getHospitalName = (hospitalId) => { - const hospital = hospitalNameList.find((hospital) => hospital.hospitalId === hospitalId); - // 병원 목록에 없으면 병원 #id로 표시 - return hospital ? hospital.hospitalName : `병원명 로딩 중 . . .병원: #${hospitalId}`; - }; + const getHospitalName = (hospitalId) => getHospitalNameByList(hospitalId, hospitalNameList); // NormalListDeep에 넘길 데이터 가공 - const sections = myAccessList.reduce((acc, cur) => { + const sections = (myAccessList || []).reduce((acc, cur) => { //acc - accumulator(누적값, 병원별로 묶안 배열), cur - current(현재 배열에서 처리중인 값) const hospitalId = cur.hospitalId; let hospitalName = getHospitalName(hospitalId); //id로 이름 찾아서 저장 @@ -246,9 +195,12 @@ const MyAccessListPage = () => { setShowModal(false)} - onModify={() => { + onConfirm={() => { setShowModal(false); - // TODO: 수정 페이지 이동 시 navigation 사용 + navigation.reset({ + index: 0, + routes: [{ name: 'MainPage', params: { passId: selectedAccess?.passId } }], + }); }} data={selectedAccess} />