correction bible du mande (store update temps reel)
This commit is contained in:
@@ -187,20 +187,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__proje
|
||||
;
|
||||
;
|
||||
;
|
||||
const PLAN_LIMITS = {
|
||||
free: {
|
||||
aiActions: 100,
|
||||
projects: 3
|
||||
},
|
||||
pro: {
|
||||
aiActions: 5000,
|
||||
projects: 20
|
||||
},
|
||||
master: {
|
||||
aiActions: 999999,
|
||||
projects: 999
|
||||
}
|
||||
};
|
||||
const useAuth = ()=>{
|
||||
const { data: session, status } = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$next$2d$auth$2f$react$2e$js__$5b$app$2d$ssr$5d$__$28$ecmascript$29$__["useSession"])();
|
||||
const [user, setUser] = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$next$2f$dist$2f$server$2f$route$2d$modules$2f$app$2d$page$2f$vendored$2f$ssr$2f$react$2e$js__$5b$app$2d$ssr$5d$__$28$ecmascript$29$__["useState"])(null);
|
||||
@@ -208,9 +194,16 @@ const useAuth = ()=>{
|
||||
// Fetch real profile from DB when session is available
|
||||
(0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$next$2f$dist$2f$server$2f$route$2d$modules$2f$app$2d$page$2f$vendored$2f$ssr$2f$react$2e$js__$5b$app$2d$ssr$5d$__$28$ecmascript$29$__["useEffect"])(()=>{
|
||||
if (session?.user?.id) {
|
||||
fetch('/api/user/profile').then((res)=>res.json()).then((dbUser)=>{
|
||||
const plan = dbUser.plan || 'free';
|
||||
const limits = PLAN_LIMITS[plan] || PLAN_LIMITS.free;
|
||||
fetch('/api/user/profile', {
|
||||
cache: 'no-store'
|
||||
}).then((res)=>res.json()).then((dbUser)=>{
|
||||
const planId = dbUser.plan || 'free';
|
||||
const planDetails = dbUser.planDetails || {
|
||||
id: 'free',
|
||||
displayName: 'Gratuit',
|
||||
maxAiActions: 100,
|
||||
maxProjects: 3
|
||||
};
|
||||
setUser({
|
||||
id: dbUser.id,
|
||||
email: dbUser.email,
|
||||
@@ -218,14 +211,15 @@ const useAuth = ()=>{
|
||||
avatar: dbUser.avatar,
|
||||
bio: dbUser.bio,
|
||||
subscription: {
|
||||
plan,
|
||||
plan: planId,
|
||||
planDetails: planDetails,
|
||||
startDate: new Date(dbUser.createdAt).getTime(),
|
||||
status: 'active'
|
||||
},
|
||||
usage: {
|
||||
aiActionsCurrent: dbUser.aiActionsUsed || 0,
|
||||
aiActionsLimit: limits.aiActions,
|
||||
projectsLimit: limits.projects
|
||||
aiActionsLimit: planDetails.maxAiActions,
|
||||
projectsLimit: planDetails.maxProjects
|
||||
},
|
||||
preferences: {
|
||||
theme: 'light',
|
||||
|
||||
Reference in New Issue
Block a user