添加刷新令牌maxAge值
This commit is contained in:
@@ -23,6 +23,7 @@ export async function login(props: {
|
||||
grant_type: 'password',
|
||||
login_type: 'phone_code',
|
||||
})
|
||||
|
||||
if (!result.success) {
|
||||
return result
|
||||
}
|
||||
@@ -38,6 +39,7 @@ export async function login(props: {
|
||||
cookieStore.set('auth_refresh', data.refresh_token, {
|
||||
httpOnly: true,
|
||||
sameSite: 'strict',
|
||||
maxAge: Number.MAX_SAFE_INTEGER,
|
||||
})
|
||||
|
||||
return {
|
||||
@@ -97,7 +99,9 @@ export async function refreshAuth() {
|
||||
|
||||
// 处理请求
|
||||
if (!resp.success) {
|
||||
cookie.delete('auth_refresh')
|
||||
if (resp.status === 401) {
|
||||
cookie.delete('auth_refresh')
|
||||
}
|
||||
throw UnauthorizedError
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user