mirror of
https://github.com/modrinth/code.git
synced 2026-07-31 13:16:38 +00:00
Fix oauth appliction icon upload (#6913)
This commit is contained in:
@@ -549,7 +549,7 @@ async function onImageSelection(files) {
|
||||
const file = files[0]
|
||||
const extFromType = file.type.split('/')[1]
|
||||
|
||||
await client.labrinth.oauth_internal.uploadAppIcon(editingId.value, file, extFromType).promise
|
||||
await client.labrinth.oauth_internal.uploadAppIcon(editingId.value, file, extFromType)
|
||||
|
||||
await refresh()
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { AbstractModule } from '../../../core/abstract-module'
|
||||
import type { UploadHandle } from '../../../types/upload'
|
||||
import type { Labrinth } from '../types'
|
||||
|
||||
export class LabrinthOAuthInternalModule extends AbstractModule {
|
||||
@@ -110,14 +109,14 @@ export class LabrinthOAuthInternalModule extends AbstractModule {
|
||||
* @param id - The OAuth client ID
|
||||
* @param file - The icon file
|
||||
* @param ext - The file extension (e.g. 'png', 'jpeg')
|
||||
* @returns UploadHandle for progress tracking and cancellation
|
||||
*/
|
||||
public uploadAppIcon(id: string, file: File | Blob, ext: string): UploadHandle<void> {
|
||||
return this.client.upload<void>(`/oauth/app/${id}/icon`, {
|
||||
public async uploadAppIcon(id: string, file: File | Blob, ext: string): Promise<void> {
|
||||
return this.client.request(`/oauth/app/${id}/icon`, {
|
||||
api: 'labrinth',
|
||||
version: 'internal',
|
||||
file,
|
||||
method: 'PATCH',
|
||||
params: { ext },
|
||||
body: file,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user