maj pricing, configuration du prisma

This commit is contained in:
2026-02-27 23:57:38 +01:00
parent 5268a7dd68
commit 521e529ab0
18 changed files with 358 additions and 42 deletions

View File

@@ -52,6 +52,15 @@ const api = {
});
}
},
// --- USER ---
user: {
async updateProfile (data) {
return api.request('/user/profile', {
method: 'PUT',
body: JSON.stringify(data)
});
}
},
// --- PROJECTS ---
projects: {
async list () {
@@ -308,12 +317,36 @@ const useAuth = ()=>{
}, [
user
]);
const updateProfile = (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$__["useCallback"])(async (updates)=>{
if (!user) return;
try {
// Unpack everything that can be updated into a flat object for the API
const apiUpdates = {};
if (updates.name !== undefined) apiUpdates.name = updates.name;
if (updates.avatar !== undefined) apiUpdates.avatar = updates.avatar;
if (updates.bio !== undefined) apiUpdates.bio = updates.bio;
if (updates.preferences?.dailyWordGoal !== undefined) apiUpdates.dailyWordGoal = updates.preferences.dailyWordGoal;
// Make the API call to update DB
await __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$src$2f$lib$2f$api$2e$ts__$5b$app$2d$ssr$5d$__$28$ecmascript$29$__["default"].user.updateProfile(apiUpdates);
// Update local state
setUser((prev)=>prev ? {
...prev,
...updates
} : null);
} catch (err) {
console.error('Failed to update profile:', err);
throw err;
}
}, [
user
]);
return {
user,
login,
signup,
logout,
incrementUsage,
updateProfile,
loading
};
};

File diff suppressed because one or more lines are too long