Skip to content

Commit

Permalink
fix: 예약 지원하는 식당이 사라졌을때 스캐너 식당 선택 다이얼로그 선택지 실종되는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
potados99 committed Feb 24, 2022
1 parent be82c8e commit 7b61391
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/features/checkin/mixins/CafeteriaSelectionMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ export default Vue.extend({
const allCafeteria = await Cafeteria.find();
const cafeteriaSupportingBooking = allCafeteria.filter(c => c.supportBooking);

const previouslySelectedId = Number.parseInt(localStorage.getItem('qr-scanner-selected-cafeteria') ?? '1');
const savedIdString = localStorage.getItem('qr-scanner-selected-cafeteria');
const savedId = savedIdString ? Number.parseInt(savedIdString) : undefined;
const selected = savedId ? cafeteriaSupportingBooking.find(c => c.id === savedId) : cafeteriaSupportingBooking[0];

if (selected) {
localStorage.setItem('qr-scanner-selected-cafeteria', selected.id.toString());
}

this.allCafeteria = cafeteriaSupportingBooking;
this.selectedCafeteria = cafeteriaSupportingBooking.find(c => c.id === previouslySelectedId); // TODO
this.selectedCafeteria = selected;
},
},
});

0 comments on commit 7b61391

Please sign in to comment.