feat(auth): implement refresh token handling and update login method
This commit is contained in:
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user