more logging
This commit is contained in:
parent
ef5f0c9444
commit
46d7f45e1a
|
@ -18,12 +18,10 @@ app.use(cors({
|
|||
// origin: "*",
|
||||
origin: inProd ? /\.lingdocs\.com$/ : "*",
|
||||
credentials: true,
|
||||
methods: ["GET","HEAD","PUT","POST","DELETE"],
|
||||
}));
|
||||
app.use((req, res, next) => {
|
||||
// res.append('Access-Control-Allow-Origin', ['*']);
|
||||
res.append('Access-Control-Allow-Methods', 'GET,HEAD,PUT,POST,DELETE');
|
||||
res.append("test-header", "cool");
|
||||
res.append('Access-Control-Allow-Methods', 'GET,HEAD,PUT,POST,DELETE,OPTIONS');
|
||||
next();
|
||||
});
|
||||
if (inProd) app.set('trust proxy', 1);
|
||||
|
|
|
@ -49,12 +49,18 @@ export async function getAllLingdocsUsers(): Promise<T.LingdocsUser[]> {
|
|||
}
|
||||
|
||||
export async function insertLingdocsUser(user: T.LingdocsUser): Promise<T.LingdocsUser> {
|
||||
try {
|
||||
const res = await usersDb.insert(user);
|
||||
const newUser = processAPIResponse(user, res);
|
||||
if (!newUser) {
|
||||
throw new Error("error inserting user");
|
||||
}
|
||||
return newUser;
|
||||
} catch(e) {
|
||||
console.log("ERROR on insertLingdocsUser", user);
|
||||
console.log(e);
|
||||
throw new Error("error inserting user");
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteLingdocsUser(uuid: T.UUID): Promise<void> {
|
||||
|
@ -104,7 +110,7 @@ export async function updateLingdocsUser(uuid: T.UUID, toUpdate:
|
|||
): Promise<T.LingdocsUser> {
|
||||
const user = await getLingdocsUser("userId", uuid);
|
||||
if (!user) throw new Error("unable to update - user not found " + uuid);
|
||||
// console.log("inUpdateLingdocsUser", toUpdate);
|
||||
console.log("inUpdateLingdocsUser", toUpdate);
|
||||
if ("tests" in toUpdate) {
|
||||
return await insertLingdocsUser({
|
||||
...user,
|
||||
|
|
Loading…
Reference in New Issue