Как я могу отладить эту проблему? Я не могу найти информацию для подражания.
У меня есть следующая сага:
export function* generateSoftwareLicenseCode({distributor, licenseType, duration}: GenerateSoftwareLicenseCodeAction) {
const username = getUsername();
const jwtToken = yield call(getJwtToken, username);
const link = new HttpLink({
uri: getGraphqlEndpointUrl,
headers: {
'x-api-key': getApiKey(),
'Authorization': jwtToken,
},
});
const client = new ApolloClient({
link: link,
cache: new InMemoryCache(),
});
try {
yield put(setStatusMessage('Generating license code...', 'info'));
yield client.mutate({
/* tslint:disable */
mutation: gql`
}
mutation licensemutation($distributor: String!, licenceType: String!, duration: String, userId: String) {
addLicenseCodeOneTimeUsage(distributor: $distributor, licenseType: $licenseType, duration: $duration, userId: $userId) {
code
}
}
`,
/* tslint:enable */
variables: {
userId: username,
distributor: distributor,
licenseType: licenseType,
duration: duration,
},
});
const doneMessage = 'License code successfully generated';
yield put(generateSoftwareLicenseCodeSucceeded(doneMessage));
} catch (error) {
const errors = error.networkError.result.errors;
yield put(generateSoftwareLicenseCodeFailed(filterErrorMessage(errors)));
}
}
export function* softwareLicenseCodesSagas() {
const generateSoftwareLicenseCodeWatcher = yield takeLatest(GENERATE_SOFTWARE_LICENSE_CODE_ACTION, generateSoftwareLicenseCode);
yield take(LOCATION_CHANGE);
yield put(clearMessages());
yield cancel(generateSoftwareLicenseCodeWatcher);
}
Блок try выдает ошибку. error
в блоке catch не определено.
Консоль показывает uncaught at at at at b TypeError: Cannot read property 'result' of undefined
Пройдя по коду, я получаю кучу библиотечного кода, который я не понимаю.