127 lines
3.3 KiB
TypeScript
127 lines
3.3 KiB
TypeScript
// Metro module 6612 (f6613).
|
|
import UserStore from "./UserStore";
|
|
import { FormStates } from "../Constants";
|
|
import Module589 from "../_bundle/Module589";
|
|
import Dispatcher from "../Dispatcher";
|
|
let CLOSED, c4240_3, c4240_4;
|
|
const handleFormClose = function handleFormClose() {
|
|
CLOSED = FormStates.CLOSED;
|
|
c4240_4 = null;
|
|
c4240_3 = {};
|
|
};
|
|
CLOSED = FormStates.CLOSED;
|
|
c4240_3 = {};
|
|
c4240_4 = null;
|
|
class UserSettingsAccountStore extends Module589.Store {
|
|
static displayName = "UserSettingsAccountStore";
|
|
initialize() {
|
|
this.waitFor(UserStore);
|
|
}
|
|
getErrors() {
|
|
return c4240_3;
|
|
}
|
|
getSubmitting() {
|
|
return CLOSED === FormStates.SUBMITTING;
|
|
}
|
|
getSettings() {
|
|
return c4240_4;
|
|
}
|
|
}
|
|
const userSettingsAccountStore = new UserSettingsAccountStore(Dispatcher, {
|
|
USER_SETTINGS_MODAL_OPEN: function handleFormOpen() {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser == null) {
|
|
CLOSED = FormStates.CLOSED;
|
|
c4240_4 = null;
|
|
c4240_3 = {};
|
|
} else {
|
|
CLOSED = FormStates.OPEN;
|
|
c4240_3 = {};
|
|
c4240_4 = {
|
|
...{
|
|
userId: currentUser.id,
|
|
username: currentUser.username,
|
|
discriminator: currentUser.discriminator,
|
|
email: currentUser.email,
|
|
avatar: currentUser.avatar,
|
|
password: "",
|
|
newPassword: null,
|
|
claimed: currentUser.isClaimed()
|
|
}
|
|
};
|
|
}
|
|
},
|
|
USER_SETTINGS_MODAL_INIT: function handleFormInit() {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser == null) {
|
|
CLOSED = FormStates.CLOSED;
|
|
c4240_4 = null;
|
|
c4240_3 = {};
|
|
return void 0;
|
|
}
|
|
CLOSED = FormStates.OPEN;
|
|
c4240_3 = {};
|
|
c4240_4 = {
|
|
...{
|
|
userId: currentUser.id,
|
|
username: currentUser.username,
|
|
discriminator: currentUser.discriminator,
|
|
email: currentUser.email,
|
|
avatar: currentUser.avatar,
|
|
password: "",
|
|
newPassword: null,
|
|
claimed: currentUser.isClaimed()
|
|
}
|
|
};
|
|
},
|
|
USER_SETTINGS_MODAL_CLOSE: handleFormClose,
|
|
LOGOUT: handleFormClose,
|
|
USER_SETTINGS_MODAL_SUBMIT: function handleFormSubmit() {
|
|
CLOSED = FormStates.SUBMITTING;
|
|
},
|
|
USER_SETTINGS_MODAL_SUBMIT_FAILURE: function handleFormSubmitFailure(a0) {
|
|
if (CLOSED !== FormStates.SUBMITTING) {
|
|
return false;
|
|
}
|
|
CLOSED = FormStates.OPEN;
|
|
let errors = a0.errors;
|
|
if (errors == null) {
|
|
errors = {};
|
|
}
|
|
c4240_3 = errors;
|
|
},
|
|
USER_SETTINGS_MODAL_UPDATE_ACCOUNT: function handleUpdateAccount({ settings }) {
|
|
if (c4240_4 == null) {
|
|
c4240_4 = {};
|
|
}
|
|
c4240_4 = {
|
|
...c4240_4,
|
|
...settings
|
|
};
|
|
},
|
|
USER_SETTINGS_MODAL_SUBMIT_COMPLETE: function handleFormSubmitComplete() {
|
|
CLOSED = FormStates.OPEN;
|
|
c4240_3 = {};
|
|
},
|
|
USER_SETTINGS_MODAL_RESET: function handleFormReset() {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
CLOSED = FormStates.OPEN;
|
|
c4240_3 = {};
|
|
if (currentUser != null) {
|
|
c4240_4 = {
|
|
...{
|
|
userId: currentUser.id,
|
|
username: currentUser.username,
|
|
discriminator: currentUser.discriminator,
|
|
email: currentUser.email,
|
|
avatar: currentUser.avatar,
|
|
password: "",
|
|
newPassword: null,
|
|
claimed: currentUser.isClaimed()
|
|
}
|
|
};
|
|
}
|
|
}
|
|
});
|
|
export default userSettingsAccountStore;
|