fix: sync db schema via prisma db push, add suppressHydrationWarning, and handle 401 profile errors gracefully
This commit is contained in:
1 parent
73e26d8f12
commit
abf22cc18d
3 files changed
+10
-3
No files matched your search
@@ -102,11 +102,14 @@ export class AuthService {
|
||||
/**
|
||||
* Get current user profile
|
||||
*/
|
||||
public async getProfile(): Promise<User> {
|
||||
public async getProfile(): Promise<User | null> {
|
||||
try {
|
||||
const response = await api.get('/users/profile');
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
if (error.response?.status === 401 || error.response?.status === 403) {
|
||||
return null;
|
||||
}
|
||||
const message = error.response?.data?.message || 'خطا در دریافت اطلاعات کاربری';
|
||||
throw new Error(Array.isArray(message) ? message[0] : message);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user