@propknot/shared-ui 1.0.17 → 1.0.18
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.
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -324,7 +324,21 @@ var AuthProvider = ({ children }) => {
|
|
|
324
324
|
const { token, user: user2 } = response.data;
|
|
325
325
|
localStorage.setItem("token", token);
|
|
326
326
|
api_default.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
327
|
-
|
|
327
|
+
const normalizedUser = {
|
|
328
|
+
...user2,
|
|
329
|
+
id: user2._id || user2.id,
|
|
330
|
+
enabledFeatures: user2.enabledFeatures || {
|
|
331
|
+
workersModule: true,
|
|
332
|
+
inventoryModule: true,
|
|
333
|
+
advancedAnalytics: false,
|
|
334
|
+
aiAssistant: true
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
setUser(normalizedUser);
|
|
338
|
+
const isOwnerRole = normalizedUser.role === "owner";
|
|
339
|
+
const hasNoCompany = !normalizedUser.company || normalizedUser.company === null || normalizedUser.company === void 0;
|
|
340
|
+
console.log("Login onboarding check:", { isOwnerRole, hasNoCompany, company: normalizedUser.company });
|
|
341
|
+
setNeedsOnboarding(isOwnerRole && hasNoCompany);
|
|
328
342
|
return { success: true };
|
|
329
343
|
} catch (error) {
|
|
330
344
|
console.error("Login failed:", error);
|