Nextcloud Login refactoring

This commit is contained in:
VincentMeilinger
2025-05-31 11:12:14 +02:00
parent 5acf3b9c4f
commit 48b31a7997
29 changed files with 1277 additions and 720 deletions

View File

@@ -77,7 +77,7 @@ class CookbookApiV1: CookbookApi {
if let id = json as? Int {
return nil
} else if let dict = json as? [String: Any] {
return .serverError
return .unknownError
}
} catch {
return .decodingFailed
@@ -103,7 +103,7 @@ class CookbookApiV1: CookbookApi {
static func updateRecipe(auth: String, recipe: Recipe) async -> (NetworkError?) {
let cookbookRecipe = CookbookApiRecipeDetailV1.fromRecipe(recipe)
guard let recipeData = JSONEncoder.safeEncode(recipe) else {
guard let recipeData = JSONEncoder.safeEncode(cookbookRecipe) else {
return .dataError
}
let request = ApiRequest(
@@ -121,7 +121,7 @@ class CookbookApiV1: CookbookApi {
if let id = json as? Int {
return nil
} else if let dict = json as? [String: Any] {
return .serverError
return .unknownError
}
} catch {
return .decodingFailed
@@ -143,7 +143,7 @@ class CookbookApiV1: CookbookApi {
return nil
}
static func getCategories(auth: String) async -> ([Category]?, NetworkError?) {
static func getCategories(auth: String) async -> ([CookbookApiCategory]?, NetworkError?) {
let request = ApiRequest(
path: basePath + "/categories",
method: .GET,