benawad / type-graphql-series

Typescript GraphQL Server built with TypeGraphQL
326 stars 129 forks source link

Upload Value Invalid #26

Closed sugamkarki closed 2 years ago

sugamkarki commented 2 years ago
 uploadClicked($event: any) {
    let file = $event.target.files[0];
    this.addPictureGQL.mutate({ picture: file }).subscribe((res) => {
      console.log(res);
    });
  }

This is my code in angular. Before you say that you don't like angular, I don't either. Its for a school project.


The code works fine with postman, but I can't mutate and keeps throwing me errors.

image

I tried

this.addPictureGQL
      // @ts-ignore
      .mutate({ variables: { picture: file } })
      .subscribe((res) => {
        console.log(res);
      });
  }

But I got image

sugamkarki commented 2 years ago

Solved it!!