Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

다른 기기에서 시간표 삭제 시 404 대응 #226

Merged
merged 2 commits into from
Oct 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.wafflestudio.snutt2.data.current_table.CurrentTableRepository
import com.wafflestudio.snutt2.data.notifications.NotificationRepository
import com.wafflestudio.snutt2.data.tables.TableRepository
import com.wafflestudio.snutt2.data.user.UserRepository
import com.wafflestudio.snutt2.lib.network.call_adapter.ErrorParsedHttpException
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
Expand All @@ -32,7 +33,11 @@ class HomeViewModel @Inject constructor(
awaitAll(
async {
currentTableRepository.currentTable.value?.let {
tableRepository.fetchTableById(it.id)
try {
tableRepository.fetchTableById(it.id)
} catch (e: ErrorParsedHttpException) {
tableRepository.fetchDefaultTable()
}
} ?: tableRepository.fetchDefaultTable()
},
async { userRepository.fetchUserInfo() },
Expand Down
Loading