Skip to content

Expose $ResponseMetadata that includes HTTP statusCode and response headers #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
imagekitio opened this issue Jul 10, 2022 · 1 comment

Comments

@imagekitio
Copy link
Contributor

No description provided.

@imagekitio imagekitio added this to the Version 2.0.0 milestone Jul 10, 2022
@imagekitio imagekitio removed this from the Version 2.0.0 milestone Nov 30, 2023
@ankur-dwivedi
Copy link

Utilize the onSuccess functionality available in the IKUpload component available in version 2.0.1. onSuccess is called if the upload is successful. The first and only argument is the response JSON from the upload API. The request-id, response headers, and HTTP status code are also accessible using the $ResponseMetadata key that is exposed from the javascript sdk. For detailed information on the IKUpload component, please visit the GitHub repository. Below is an example code snippet:

<template>
  <IKUpload 
    :onUploadStart="onUploadStart" 
    :onUploadProgress="onUploadProgress"
    :tags="['tag1','tag2']"
    :responseFields="['tags']"
    :onError="onError"
    :onSuccess="onSuccess"
    customCoordinates="10,10,100,100"
  />
</template>

<script>
import { IKUpload } from "imagekitio-vue"

export default {
  name: "app",
  components: {},
  data() {
    return {};
  },
  methods: {
    onError(err) {
      console.log("Error");
      console.log(err);
    },
    onSuccess(res) {
      console.log("Success");
      console.log(res);
    }
    onUploadProgress(evt) {
      console.log("Inprogress ... ", evt);
    };
    onUploadStart(evt) {
      console.log("Upload started");
    },
  }
};
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants