maj pricing, configuration du prisma
This commit is contained in:
@@ -46,6 +46,15 @@ const api = {
|
||||
});
|
||||
}
|
||||
},
|
||||
// --- USER ---
|
||||
user: {
|
||||
async updateProfile (data) {
|
||||
return api.request('/user/profile', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
}
|
||||
},
|
||||
// --- PROJECTS ---
|
||||
projects: {
|
||||
async list () {
|
||||
@@ -323,16 +332,44 @@ const useAuth = ()=>{
|
||||
}["useAuth.useCallback[incrementUsage]"], [
|
||||
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$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useCallback"])({
|
||||
"useAuth.useCallback[updateProfile]": 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$client$5d$__$28$ecmascript$29$__["default"].user.updateProfile(apiUpdates);
|
||||
// Update local state
|
||||
setUser({
|
||||
"useAuth.useCallback[updateProfile]": (prev)=>prev ? {
|
||||
...prev,
|
||||
...updates
|
||||
} : null
|
||||
}["useAuth.useCallback[updateProfile]"]);
|
||||
} catch (err) {
|
||||
console.error('Failed to update profile:', err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}["useAuth.useCallback[updateProfile]"], [
|
||||
user
|
||||
]);
|
||||
return {
|
||||
user,
|
||||
login,
|
||||
signup,
|
||||
logout,
|
||||
incrementUsage,
|
||||
updateProfile,
|
||||
loading
|
||||
};
|
||||
};
|
||||
_s(useAuth, "NTps7lD2LRTcy9ISlNr85D5h8IY=", false, function() {
|
||||
_s(useAuth, "BDPqFrun1TL0uUzYZo247zjajj4=", false, function() {
|
||||
return [
|
||||
__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$client$5d$__$28$ecmascript$29$__["useSession"]
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user