@loomcore/api 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export let config;
|
|
2
2
|
let isConfigSet = false;
|
|
3
|
+
function copyOnlyBaseApiConfigProperties(obj) {
|
|
4
|
+
const baseConfig = {};
|
|
5
|
+
Object.keys(obj).forEach((key) => {
|
|
6
|
+
baseConfig[key] = obj[key];
|
|
7
|
+
});
|
|
8
|
+
return baseConfig;
|
|
9
|
+
}
|
|
3
10
|
export function setBaseApiConfig(baseApiConfig) {
|
|
4
11
|
if (!isConfigSet) {
|
|
5
|
-
config = baseApiConfig;
|
|
12
|
+
config = copyOnlyBaseApiConfigProperties(baseApiConfig);
|
|
6
13
|
isConfigSet = true;
|
|
7
14
|
}
|
|
8
15
|
else if (config.env !== 'test') {
|
|
@@ -226,11 +226,6 @@ export class AuthService extends GenericApiService {
|
|
|
226
226
|
maxAge: config.auth.deviceIdCookieMaxAgeInDays * 24 * 60 * 60 * 1000,
|
|
227
227
|
httpOnly: true
|
|
228
228
|
};
|
|
229
|
-
if (config.env === 'local' || config.env === 'dev') {
|
|
230
|
-
console.log('setting deviceId cookieOptions sameSite=none and secure=true');
|
|
231
|
-
cookieOptions['sameSite'] = 'none';
|
|
232
|
-
cookieOptions['secure'] = true;
|
|
233
|
-
}
|
|
234
229
|
res.cookie('deviceId', deviceId, cookieOptions);
|
|
235
230
|
}
|
|
236
231
|
return deviceId;
|