Skip to content

Commit

Permalink
APIの名前変更に対応 / 不要なDetail取得の廃止
Browse files Browse the repository at this point in the history
  • Loading branch information
Pugma committed Jan 18, 2024
1 parent fde4f1a commit 7661e23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/components/Events/EventItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { ref, onMounted, onUnmounted } from 'vue'
import apis, {
EventDetail,
Event,
EditEventRequest,
EventLevel
Expand All @@ -27,15 +26,14 @@ const props = defineProps<Props>()
const displayMenu = ref(false)
const eventDetail: EventDetail = (await apis.getEvent(props.event.id)).data
const eventLevelValue = ref<EventLevelValue>(
eventLevelValueMap[eventDetail.eventLevel]
eventLevelValueMap[props.event.level]
)
const updateEventLevel = async (v: EventLevelValue) => {
eventLevelValue.value = v
const currentEventLevel: EventLevel = getEventLevelFromValue(v)
const editReq: EditEventRequest = { eventLevel: currentEventLevel }
const editReq: EditEventRequest = { level: currentEventLevel }
await apis.editEvent(props.event.id, editReq)
useEventStore().mutate()
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ const { mutate } = useEventStore()
const eventId = useParam('id')
const event: EventDetail = (await apis.getEvent(eventId.value)).data
const eventLevel = ref<EventLevelValue>(eventLevelValueMap[event.eventLevel])
const eventLevel = ref<EventLevelValue>(eventLevelValueMap[event.level])
const isSending = ref(false)
const updateEvent = async () => {
isSending.value = true
try {
const requestData: EditEventRequest = {
eventLevel: getEventLevelFromValue(eventLevel.value)
level: getEventLevelFromValue(eventLevel.value)
}
await apis.editEvent(eventId.value, requestData)
mutate()
Expand Down

0 comments on commit 7661e23

Please sign in to comment.