All checks were successful
build-image / build (push) Successful in 12m38s
Meteor.users.update() is sync-only and no longer exists server-side under Meteor 3, so it threw on every call, surfacing as a generic 500 to the client. users.setLang runs on every page load for logged-in users, which is what broke /zones; the same bug in edit-profile.js was silently breaking /profile too.
32 lines
740 B
JavaScript
32 lines
740 B
JavaScript
/* eslint-disable consistent-return */
|
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
let action;
|
|
|
|
const updateUser = async (userId, { emailAddress, profile }) => {
|
|
try {
|
|
await Meteor.users.updateAsync(userId, {
|
|
$set: {
|
|
'emails.0.address': emailAddress,
|
|
profile,
|
|
},
|
|
});
|
|
} catch (exception) {
|
|
action.reject(`[editProfile.updateUser] ${exception}`);
|
|
}
|
|
};
|
|
|
|
const editProfile = async ({ userId, profile }, promise) => {
|
|
try {
|
|
action = promise;
|
|
await updateUser(userId, profile);
|
|
action.resolve();
|
|
} catch (exception) {
|
|
action.reject(`[editProfile.handler] ${exception}`);
|
|
}
|
|
};
|
|
|
|
export default options =>
|
|
new Promise((resolve, reject) =>
|
|
editProfile(options, { resolve, reject }));
|