refactor: abstract exception capture out of is-still-verified
This commit is contained in:
@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
@@ -2,13 +2,9 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
await getCurrentUser($);
|
||||
await getCurrentUser($);
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
@@ -1,17 +1,13 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const params = {
|
||||
method: 'flickr.test.login',
|
||||
format: 'json',
|
||||
nojsoncallback: 1,
|
||||
};
|
||||
const response = await $.http.get('/rest', { params });
|
||||
return !!response.data.user.id;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
const params = {
|
||||
method: 'flickr.test.login',
|
||||
format: 'json',
|
||||
nojsoncallback: 1,
|
||||
};
|
||||
const response = await $.http.get('/rest', { params });
|
||||
return !!response.data.user.id;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const user = await getCurrentUser($);
|
||||
return !!user.id;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
const user = await getCurrentUser($);
|
||||
return !!user.id;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const user = await getCurrentUser($);
|
||||
return !!user;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
const user = await getCurrentUser($);
|
||||
return !!user;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const user = await getCurrentUser($);
|
||||
return !!user.id;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
const user = await getCurrentUser($);
|
||||
return !!user.id;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const user = await getCurrentUser($);
|
||||
return !!user;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
const user = await getCurrentUser($);
|
||||
return !!user;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
Reference in New Issue
Block a user