feat(garmin): 增加「退出 Garmin 账号」功能,删除已保存令牌以便重新登录
backend: services/garmin.py 新增 delete_token(),删除 garmin_tokens 行并 forget_client 丢弃缓存会话;routes/garmin.py 新增 POST /api/garmin/disconnect(require_auth),返回 ok + 提示文案。 frontend: api.ts 增加 disconnectGarmin();SyncPage 增加「退出 Garmin 账号」按钮(带二次确认弹窗);DataSync.css 增加危险色样式。 设计:仅删除 OAuth 令牌,保留 users.garmin_email,下次重登只需密码;已同步的健康数据不受影响。
This commit is contained in:
@@ -467,6 +467,14 @@ class ApiClient {
|
||||
return data.hasToken;
|
||||
}
|
||||
|
||||
/** Drop the stored Garmin OAuth token; the next sync must re-authenticate. */
|
||||
async disconnectGarmin() {
|
||||
const { data } = await this.client.post<{ ok: boolean; message?: string }>(
|
||||
'/garmin/disconnect'
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start an interactive Garmin login. Returns a session id; the login runs
|
||||
* in the background and parks if Garmin asks for a two-factor code.
|
||||
|
||||
Reference in New Issue
Block a user