Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var Store = require('flux/utils').Store;
var AppDispatcher = require('../dispatcher/dispatcher');
var UserConstants = require('../constants/userConstants');
var SessionStore = require('./sessionStore');
var _users = [];
var _viewedUser = {};
var UserStore = new Store(AppDispatcher);
UserStore.allUsers = function () {
var currentUser = SessionStore.currentUser();
var cUserIdx;
if (currentUser.username) {
_users.forEach(function (user, index) {
if (user.username === currentUser.username) {
cUserIdx = index;
}
});
_users.splice(cUserIdx, 1);
}
// NOT INCL. THE CURRENT USER
// react
const Store = require('flux/utils').Store;
// project
const ActivityConstants = require('../constants/activity_constants');
const AppDispatcher = require('../dispatchers/dispatcher');
const ErrorConstants = require('../constants/error_constants');
const ActivityStore = new Store(AppDispatcher);
// instance vars
let _orderedActivities = [];
let _newActivity = {};
ActivityStore.all = () => {
return _orderedActivities;
};
ActivityStore.find = (id) => {
return _retrieveActivity(id);
};
ActivityStore.__onDispatch = (payload) => {
switch(payload.actionType) {
case ActivityConstants.RECEIVE_ACTIVITIES:
// react
const Store = require('flux/utils').Store;
// project
const AppDispatcher = require('../dispatchers/dispatcher');
const ErrorConstants = require('../constants/error_constants');
// instance vars
let _errors = [];
let _form = "";
const ErrorStore = new Store(AppDispatcher);
ErrorStore.clearErrors = () => {
_errors = [];
ErrorStore.__emitChange();
};
// return errors to matching form
ErrorStore.errors = (form) => {
if (form === _form) {
return _errors.slice();
} else {
return [];
}
};
ErrorStore.__onDispatch = (payload) => {
var Store = require('flux/utils').Store;
var LessonConstants = require('../constants/lesson_constants');
var AppDispatcher = require('../dispatcher/dispatcher');
var ModalStore = require('./modal_store');
var LessonStore = new Store(AppDispatcher);
var _lessons = {};
var resetLessons = function (lessons) {
_lessons = Object.assign({}, lessons);
};
var addLesson = function (lesson) {
_lessons[lesson.id] = lesson;
};
LessonStore.all = function () {
return Object.assign({}, _lessons);
};
LessonStore.find = function (lessonId) {
return _lessons[lessonId];
var Store = require("flux/utils").Store;
var AppDispatcher = require("../dispatcher/dispatcher");
var ActionTypes = require("../constants/app_constants").ActionTypes;
var _showModal = false;
var _isLoggingIn = false;
var _errors = [];
var LoginModalStore = new Store(AppDispatcher);
LoginModalStore.__onDispatch = function (payload) {
var actionType = payload.actionType;
var response = payload.response;
_errors = [];
switch (actionType) {
case ActionTypes.SHOW_LOGIN_MODAL:
setShowModal(true);
break;
case ActionTypes.CLOSE_LOGIN_MODAL:
setShowModal(false);
break;
var Store = require('flux/utils').Store,
AppDispatcher = require('../dispatcher/Dispatcher'),
ErrorConstants = require('../constants/ErrorConstants');
var ErrorStore = new Store(AppDispatcher);
var _errors = {};
var _form = "";
ErrorStore.formErrors = function (form) {
if (form !== _form) {
return {};
}
var result = {};
var errors;
Object.keys(_errors).forEach(function (field) {
errors = _errors[field];
result[field] = errors.slice();
});
var Store = require("flux/utils").Store;
var AppDispatcher = require("../dispatcher/dispatcher");
var AppConstants = require("../constants/app_constants");
var ActionTypes = AppConstants.ActionTypes;
var _user = {};
var _errors = [];
var ProfileStore = new Store(AppDispatcher);
ProfileStore.__onDispatch = function (payload) {
var actionType = payload.actionType;
var response = payload.response;
switch (actionType) {
case ActionTypes.LOGIN_RESPONSE:
if (response.errors) {
setErrors(response.errors);
} else {
setUser(response);
}
break;
var Store = require("flux/utils").Store;
var AppDispatcher = require("../dispatcher/dispatcher");
var ActionTypes = require("../constants/app_constants").ActionTypes;
var _showModal = false;
var _isSaving = false;
var _publicUrl = null;
var _progress = 0;
var _responseStatus = null;
var _newTrackPathname = null;
var _errors = [];
var UploadStore = new Store(AppDispatcher);
UploadStore.__onDispatch = function (payload) {
var actionType = payload.actionType;
var response = payload.response;
_newTrackPathname = null;
_errors = [];
switch (actionType) {
case ActionTypes.SHOW_UPLOAD_MODAL:
setShowModal(true);
break;
case ActionTypes.CLOSE_UPLOAD_MODAL:
resetUploadStore();
var Store = require('flux/utils').Store;
var AppDispatcher = require('../dispatcher/dispatcher');
var MessageStore = new Store(AppDispatcher);
var MessageConstants = require('../constants/messageConstants');
_conversations = [];
var _activeConvos = [];
MessageStore.allConversations = function () {
return _conversations;
};
MessageStore.activeConvos = function () {
return _activeConvos;
};
MessageStore.closeConvo = function (convo_name) {
var convoIdx;