Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
map((params: any) => {
if (!params.error) {
return new NbAuthResult(
true,
params,
this.getOption('redirect.success'),
[],
this.getOption('defaultMessages'),
this.createToken(params, requireValidToken));
}
return new NbAuthResult(
false,
params,
this.getOption('redirect.failure'),
this.getOption('defaultErrors'),
[],
);
}),
catchError(err => {
map((params: any) => {
if (!params.error) {
return new NbAuthResult(
true,
params,
this.getOption('redirect.success'),
[],
this.getOption('defaultMessages'),
this.createToken(params, requireValidToken));
}
return new NbAuthResult(
false,
params,
this.getOption('redirect.failure'),
this.getOption('defaultErrors'),
[],
);
}),
catchError(err => {
catchError(err => {
const errors = [];
if (err instanceof NbAuthIllegalTokenError) {
errors.push(err.message);
} else {
errors.push('Something went wrong.');
}
return of(
new NbAuthResult(
false,
err,
this.getOption('redirect.failure'),
errors,
));
}),
);
map((params: any) => {
if (!params.error) {
return new NbAuthResult(
true,
params,
this.getOption('redirect.success'),
[],
this.getOption('defaultMessages'),
this.createToken(params, requireValidToken));
}
return new NbAuthResult(
false,
params,
this.getOption('redirect.failure'),
this.getOption('defaultErrors'),
[],
);
}),
catchError(err => {
catchError(err => {
const errors = [];
if (err instanceof NbAuthIllegalTokenError) {
errors.push(err.message);
} else {
errors.push('Something went wrong.');
}
return of(
new NbAuthResult(
false,
err,
this.getOption('redirect.failure'),
errors,
));
}),
);
map((params: any) => {
if (!params.error) {
return new NbAuthResult(
true,
params,
this.getOption('redirect.success'),
[],
this.getOption('defaultMessages'),
this.createToken(params, requireValidToken));
}
return new NbAuthResult(
false,
params,
this.getOption('redirect.failure'),
this.getOption('defaultErrors'),
[],
);
}),
catchError(err => {
switchMap((params: any) => {
if (params.code) {
return this.requestToken(params.code);
}
return of(
new NbAuthResult(
false,
params,
this.getOption('redirect.failure'),
this.getOption('defaultErrors'),
[],
));
}),
);
switchMap((params: any) => {
if (params.code) {
return this.requestToken(params.code);
}
return of(
new NbAuthResult(
false,
params,
this.getOption('redirect.failure'),
this.getOption('defaultErrors'),
[],
));
}),
);