Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
takeLatest(userActions.ACCEPT_TERMS, function*() {
try {
yield call(acceptTos);
} catch (e) {
// TODO: log error to server, conveyor is unavailable
}
}),
takeLatest(userActions.VOTING_POWER_LOOKUP, lookupVotingPower),
// Only a block author can make themself it, actor === gameEvent.target
if (started === true && gameEvent.event === 'tag' && gameEvent.source === tagged.address && actor === gameEvent.target) {
const newlyTagged: IContact = yield call([Textile.contacts, 'get'], gameEvent.target)
yield put(MainActions.newTag(tagged, newlyTagged, file.block, file.date.seconds as number))
tagged = newlyTagged
}
}
if (started) {
yield put(MainActions.startGameSuccess(startTime))
}
yield put(MainActions.setCurrentIt(tagged))
yield call(refreshGameContacts, thread)
yield call(updateMessages, thread)
} catch (error) {
yield put(MainActions.pushNewMessage(
{type: 'text', message: `Uh oh: ${error.message}`}
))
}
}
export function* handleFetchProfile(action: PassportRequestAction): any {
const userId = action.payload.userId
try {
const serverUrl = yield select(getProfileDownloadServer)
const accessToken = yield select(getAccessToken)
const profile = yield call(profileServerRequest, serverUrl, userId, accessToken)
const currentId = yield select(getCurrentUserId)
if (currentId === userId) {
profile.email = yield select(getEmail)
}
if (profile.ethAddress) {
yield put(inventoryRequest(userId, profile.ethAddress))
const inventoryResult = yield race({
success: take(isActionFor(INVENTORY_SUCCESS, userId)),
failure: take(isActionFor(INVENTORY_FAILURE, userId))
})
if (inventoryResult.failure) {
defaultLogger.error(`Unable to fetch inventory for ${userId}:`, inventoryResult.failure)
} else {
profile.inventory = (inventoryResult.success as InventorySuccess).payload.inventory.map(dropIndexFromExclusives)
}
} else {
export function* handleCreateProject(action) {
const successMessage = translate('Project has been created.');
const errorMessage = translate('Project could not be created.');
try {
const customer = yield select(getCustomer);
const response = yield call(api.createProject, {...action.payload, customer});
const project = response.data;
yield call(api.gotoProjectDetails, project);
yield call(api.refreshProjectList, project);
yield put(createProject.success());
yield put(showSuccess(successMessage));
} catch (error) {
const formError = new SubmissionError({
_error: errorMessage,
name: error.data.name,
});
yield put(createProject.failure(formError));
}
}
export function* uploadWorklog(options: any): Generator<*, *, *> {
try {
yield call(
infoLog,
'started uploading worklog with options:',
options,
);
/*
const {
issueId,
comment,
timeSpentInSeconds,
screenshotsPeriod,
worklogType,
screenshots,
activity,
keepedIdles,
} = options;
*/
function* checkThemeStateIterator() {
const theme = yield call(getThemeFromStorage);
if (theme) {
yield put(setThemeState(theme));
} else {
yield put(setThemeState(''));
}
}
function* getAlbumCandidatesFromItems(apis, selectedItems) {
const { splitFoldersAndFiles } = apis;
const { folders, files } = yield call(splitFoldersAndFiles, selectedItems);
const [candidateFromFiles, candidatesFromFolders] = yield all([
call(getCandidateFromFiles, apis, files),
call(getAlbumCandidatesFromFolders, apis, folders),
]);
const candidates = [];
if (candidateFromFiles) {
candidates.push(candidateFromFiles);
}
if (candidatesFromFolders) {
candidates.push(...candidatesFromFolders);
}
return candidates;
}
function* list({ params }) {
yield put({
type: types.express.START_GET_EXPRESS_LIST
})
const e = yield call(Fetch.fetch, { api: ExpressApi.list, params })
if (e.code === 0) {
yield put(saveList({ result: e.result, params }))
} else {
message.warning(e.msg)
}
}