Unexpected token ')' on api subscribtion

Discussão em 'Angular' iniciado por Danny220, Janeiro 16, 2025.

  1. Danny220

    Danny220 Guest

    I have this API call in an angular application

    async upload(file: FileToUpload) { // this is where the error occurs
    file.id = UUID.UUID();

    this.delegates.fileManager.uploadFile(file).subscribe({
    next: async () => {
    this.files = await (await this.delegates.fileManager.getFilesAsync()).files;
    console.log(this.files);
    }
    });
    }


    the function should upload the file and refresh the file listing with an another api call. This aproach works on the delete function

    async deleteFile(file: FileToUpload) {
    this.delegates.fileManager.deleteFileById(file.id).subscribe({
    next: async () => {
    this.files = await (await this.delegates.fileManager.getFilesAsync()).files;
    }
    })
    }


    and while the uploading works, the list doesn't refresh instantly as I have to refresh the page to see the new item. It throws ERROR SyntaxError: Unexpected token ')' even if the this.files = await (await this.delegates.fileManager.getFilesAsync()).files; is not here.

    Continue reading...

Compartilhe esta Página