Skip to content

feat: image upload functionality#6635

Merged
michelleinez merged 1 commit intomainfrom
CIT-3802
Feb 6, 2026
Merged

feat: image upload functionality#6635
michelleinez merged 1 commit intomainfrom
CIT-3802

Conversation

@michelleinez
Copy link
Contributor

No description provided.

@michelleinez
Copy link
Contributor Author

Note that the updateProfileImage endpoint does not yet exist, but will be merged soon by Leo here: https://github.com/kiva/kiva/pull/14077

I also added an optional appHost parameter to the useImageUpload function for local dev purposes because this will not work locally unless we hit dev... This should just default to the appropriate url for the environment when we are in dev / staging / prod envs though.

@michelleinez michelleinez requested a review from a team February 5, 2026 23:51
preFetch: true,
result({ data }) {
this.loading = false;
console.log('lenderProfileQuery result', data?.my?.lender ?? data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove

const isViewingFromDifferentOrigin = typeof window !== 'undefined' && appOrigin
&& window.location.origin !== appOrigin;
const uploadEndpoint = isViewingFromDifferentOrigin ? `${appOrigin}/img/upload` : '/img/upload';
const response = await fetch(uploadEndpoint, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using REST endpoint instead of gql?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why was that needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was asked to port over this functionality and use cms-page-server as the precedent example.
The cms-page-server does the same thing: it uses a REST endpoint for the image upload.
In cms-page-server (composables/useImageUpload.ts):
It builds multipart form data and sends it with $fetch('/img/upload', { method: 'POST', body: formData }).
It does not use a GraphQL mutation for the file upload.
After a successful upload it gets back an image object (with id) and returns that id for use in a GraphQL mutation to attach the image to a profile.

The GraphQL multipart spec is not supported by our server or client as far as I know.

@michelleinez michelleinez merged commit e3c47ad into main Feb 6, 2026
5 checks passed
@michelleinez
Copy link
Contributor Author

oops, I just saw that this was approved and merged prematurely before noticing there were also comments. I'll make the requested changes now in a separate commit sorry

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

Successfully merging this pull request may close these issues.

3 participants