feat(auth): implement refresh token handling and update login method

This commit is contained in:
hamed
2026-06-25 17:37:55 +03:30
parent 694ee28787
commit 9b608aaeac
3 changed files with 62 additions and 7 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ export default function LoginPage() {
});
const json = await res.json();
if (!res.ok) { toast.error(json?.errors?.[0]?.message ?? 'خطا در ورود'); return; }
login(json.access_token);
login(json.access_token, json.refresh_token);
toast.success('خوش آمدید');
} catch { toast.error('خطا در اتصال به سرور'); }
finally { setPwLoading(false); }
@@ -121,7 +121,7 @@ export default function LoginPage() {
});
const lJson = await lRes.json();
if (!lRes.ok) { toast.error(lJson?.errors?.[0]?.message ?? 'کاربری با این شماره یافت نشد'); return; }
login(lJson.access_token);
login(lJson.access_token, lJson.refresh_token);
toast.success('خوش آمدید');
} catch { toast.error('خطا در اتصال به سرور'); }
finally { setSmsLoading(false); }