From 9ff3aedcf7f6411f9c9b856dc8e59ec5a1c9aa35 Mon Sep 17 00:00:00 2001 From: hhhello Date: Mon, 7 Oct 2024 12:37:29 +0900 Subject: [PATCH] Fix meal --- Graduating-iOS/Data/Network/MealService.swift | 16 +++++----------- .../Feature/Main/Meal/MealViewModel.swift | 12 +++++------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Graduating-iOS/Data/Network/MealService.swift b/Graduating-iOS/Data/Network/MealService.swift index 0e00eec..738f20a 100644 --- a/Graduating-iOS/Data/Network/MealService.swift +++ b/Graduating-iOS/Data/Network/MealService.swift @@ -1,10 +1,3 @@ -// -// MealService.swift -// Data -// -// Created by hhhello0507 on 8/28/24. -// - import Foundation import Combine import MyMoya @@ -13,14 +6,15 @@ import Model import Shared public enum MealEndpoint: MyTarget { - case fetchMeals(schoolId: Int) + case fetchMeals } extension MealEndpoint { public var host: String { "meals" } public var route: Route { switch self { - case .fetchMeals(let schoolId): .get("\(schoolId)") + case .fetchMeals: + .get() } } @@ -32,7 +26,7 @@ extension MealEndpoint { public struct MealService { public static let shared = Self() - public func fetchMeals(schoolId: Int) -> AnyPublisher<[Meal], APIError> { - runner.deepDive(MealEndpoint.fetchMeals(schoolId: schoolId), res: [Meal].self) + public func fetchMeals() -> AnyPublisher<[Meal], APIError> { + runner.deepDive(MealEndpoint.fetchMeals, res: [Meal].self) } } diff --git a/Graduating-iOS/Graduating/Feature/Main/Meal/MealViewModel.swift b/Graduating-iOS/Graduating/Feature/Main/Meal/MealViewModel.swift index a700f3a..44d4882 100644 --- a/Graduating-iOS/Graduating/Feature/Main/Meal/MealViewModel.swift +++ b/Graduating-iOS/Graduating/Feature/Main/Meal/MealViewModel.swift @@ -12,12 +12,10 @@ public final class MealViewModel: ObservableObject { extension MealViewModel { func fetchMeals(schoolId: Int) { - MealService.shared.fetchMeals( - schoolId: schoolId - ) - .resource(\.meals, on: self) - .ignoreError() - .silentSink() - .store(in: &subscriptions) + MealService.shared.fetchMeals() + .resource(\.meals, on: self) + .ignoreError() + .silentSink() + .store(in: &subscriptions) } }