Skip to content

Instantly share code, notes, and snippets.

@SahanAmarsha
Created January 24, 2022 19:37
Show Gist options
  • Save SahanAmarsha/d3c88530ef636621ebef47a53c86c2a7 to your computer and use it in GitHub Desktop.
Save SahanAmarsha/d3c88530ef636621ebef47a53c86c2a7 to your computer and use it in GitHub Desktop.
import { DataStore } from "@aws-amplify/datastore";
import { Car } from "./models";
...
const saveCar = async () => {
try {
await DataStore.save(
new Car({
name: name,
price: parseFloat(price),
description: description,
imageUrl: imageUrl,
})
);
} catch (err) {
console.log(err);
}
};
...
const addCarOverrides = {
....
"Flex.Flex[0].Flex[2].Button[0]": {
onClick: saveCar,
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment