Below is some sample Vue.js code to get you started with our CSV Importer. Be sure to insert your own Organization’s API key and an Importer ID from your account. You can find them on the Importers page of your account.

<script>
  import FuseImporter from "fuse-importer";

  export default {
    data() {
      return {};
    },
    methods: {
      showImporter() {
        const organizationApiKey = "YOUR ORGANIZATIONS API KEY";
        const templateId = "YOUR TEMPLATE ID";

        if (
          organizationApiKey.indexOf("YOUR") !== -1 ||
          templateId.indexOf("YOUR") !== -1
        ) {
          window.confirm(
            "You need to configure your organization api key and template id."
          );
          return;
        }

        const importer = new FuseImporter(organizationApiKey, templateId);

        importer.onSubmit = async (records) => {
          return {
            message: "Data imported successfully",
            errors: {},
          };
        };

        importer.onValidateRecord = async (record) => {
          return { errors: {}, warnings: {} };
        };

        importer.show();
      },
    },
  };
</script>
<template>
  <button @click="showImporter()">Show Importer</button>
</template>

<style></style>