mirror of
https://github.com/modrinth/code.git
synced 2026-09-02 04:56:52 +00:00
fix tauri throwing error when api returns 204 No Content
This commit is contained in:
@@ -103,8 +103,11 @@ export class TauriModrinthClient extends XHRUploadClient {
|
||||
throw error
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
return data as T
|
||||
const text = await response.text()
|
||||
if (!text) {
|
||||
return undefined as T
|
||||
}
|
||||
return JSON.parse(text) as T
|
||||
} catch (error) {
|
||||
throw this.normalizeError(error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user