Skip to content

Conversation

@GunnarLieb
Copy link
Contributor

create dedicated /api/v1/users/:id/avatar endpoint. Reduces token size. Backend validates and processes images.

- Remove avatar from JWT token payload and create dedicated /api/v1/users/:id/avatar endpoint. Reduces token size. Backend validates and processes images.
Copy link
Contributor

@jclausen jclausen left a comment

Choose a reason for hiding this comment

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

I'm a bit confused on how this PR is optimizing the token size since we already removed that from the custom claims in a previous pull request? We're also resizing the image twice and duplicating a bunch of code.

Some changes requested, as well as some clarification on the need for this PR.

allowLogin : true
}
},
defaultAvatar : "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCADIAMgDASIAAhEBAxEB/8QAHQABAAIDAQEBAQAAAAAAAAAAAAcIBAUGAgEDCf/EAEYQAAEDAwICBAsHAgMGBwAAAAEAAgMEBQYHERIhMVFhcQgTFRYiQVWRobHRFDI1c4GS8P8"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use the store to provide the default avatar, rather than hard-coding it in to two different places. ( here and above )

fetchUsers(){
usersAPI.list( { "sortOrder" : "lastName DESC, firstName DESC" }, this.authToken )
.then( result => this.usersData = result.data )
.then( result => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just modify line 100 of UserService to pass includes="avatar" to the getMemento() call. Then there's no need for a separate AJAX call for each user. Same with the user API single user method.

errors : []
}
},
defaultAvatar : "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCADIAMgDASIAAhEBAxEB/8QAHQABAAIDAQEBAQAAAAAAAAAAAAcIBAUGAgEDCf/EAEYQAAEDAwICBAsHAgMGBwAAAAEAAgMEBQYHERIhMVFhcQgTFRYiQVSRobHRFDI1c4GS8P8"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same note as above. Just make this a store property and bring it in that way.

return this;
}

function processAvatar(){
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little confused on the need for this, since it's already being resized in the javascript code prior to the upload. Can you clarify?

@GunnarLieb
Copy link
Contributor Author

Thanks for reviewing and the remarks, I agree, will create a new PR

@GunnarLieb GunnarLieb closed this Jan 10, 2026
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.

2 participants