Auth and session middleware.

This commit is contained in:
Mike Cao 2020-07-27 23:52:14 -07:00
parent 590a70c2ff
commit d81ee3932d
14 changed files with 142 additions and 73 deletions

View file

@ -1,5 +1,5 @@
import { getWebsite, getSession, createSession } from 'lib/db';
import { getCountry, getDevice, getIpAddress } from 'lib/utils';
import { getCountry, getDevice, getIpAddress } from 'lib/request';
import { uuid, isValidId, verifyToken } from 'lib/crypto';
export default async req => {
@ -46,6 +46,8 @@ export default async req => {
session_id,
session_uuid,
};
} else {
throw new Error(`Invalid website: ${website_uuid}`);
}
}
}