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 file = files[0]
|
||||||
const extFromType = file.type.split('/')[1]
|
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()
|
await refresh()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { AbstractModule } from '../../../core/abstract-module'
|
import { AbstractModule } from '../../../core/abstract-module'
|
||||||
import type { UploadHandle } from '../../../types/upload'
|
|
||||||
import type { Labrinth } from '../types'
|
import type { Labrinth } from '../types'
|
||||||
|
|
||||||
export class LabrinthOAuthInternalModule extends AbstractModule {
|
export class LabrinthOAuthInternalModule extends AbstractModule {
|
||||||
@@ -110,14 +109,14 @@ export class LabrinthOAuthInternalModule extends AbstractModule {
|
|||||||
* @param id - The OAuth client ID
|
* @param id - The OAuth client ID
|
||||||
* @param file - The icon file
|
* @param file - The icon file
|
||||||
* @param ext - The file extension (e.g. 'png', 'jpeg')
|
* @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> {
|
public async uploadAppIcon(id: string, file: File | Blob, ext: string): Promise<void> {
|
||||||
return this.client.upload<void>(`/oauth/app/${id}/icon`, {
|
return this.client.request(`/oauth/app/${id}/icon`, {
|
||||||
api: 'labrinth',
|
api: 'labrinth',
|
||||||
version: 'internal',
|
version: 'internal',
|
||||||
file,
|
method: 'PATCH',
|
||||||
params: { ext },
|
params: { ext },
|
||||||
|
body: file,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user