Skip to content

Instantly share code, notes, and snippets.

@britez13
Created March 18, 2023 01:25
Show Gist options
  • Save britez13/66b9f9510f41c9dc216110d69fd097d9 to your computer and use it in GitHub Desktop.
Save britez13/66b9f9510f41c9dc216110d69fd097d9 to your computer and use it in GitHub Desktop.
async handleRegister(data) {
let formData = new FormData();
formData.append('name', 'hola');
formData.append('email', data.email)
formData.append('password', data.password)
formData.append('password_confirmation', data.password_confirmation)
formData.append('file', data.file)
await this.getToken();
try {
await axios.post("/register", formData, {
headers: {
"content-type": "multipart/form-data",
},
});
this.router.push("/");
} catch (error) {
console.log(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment