Merge pull request #1892 from PRB0t/pr-201807131656

Fix a bug
This commit is contained in:
syuilo 2018-07-13 23:20:40 +09:00 committed by GitHub
commit 09416c9893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,8 @@ import { IApp } from '../../models/app';
export default (endpoint: string | Endpoint, user: IUser, app: IApp, data: any, file?: any) => new Promise<any>(async (ok, rej) => { export default (endpoint: string | Endpoint, user: IUser, app: IApp, data: any, file?: any) => new Promise<any>(async (ok, rej) => {
const isSecure = user != null && app == null; const isSecure = user != null && app == null;
const ep = typeof endpoint == 'string' ? endpoints.find(e => e.name == endpoint) : endpoint; const epName = typeof endpoint === 'string' ? endpoint : endpoint.name;
const ep = endpoints.find(e => e.name === epName);
if (ep.name.includes('.')) { if (ep.name.includes('.')) {
return rej('INVALID_ENDPOINT'); return rej('INVALID_ENDPOINT');