API版本化:迁移账号凭证与登录信息入口
This commit is contained in:
1 parent
eb8a54698c
commit
3d493ce2d4
6 files changed
+110
-9
No files matched your search
@@ -315,7 +315,7 @@ test('account cookie APIs include login_method when provided', async () => {
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
|
||||
await addAccount('acc1', 'unb=acc1', 'qr_scan');
|
||||
expect(fetchMock).toHaveBeenCalledWith('/cookies', expect.objectContaining({
|
||||
expect(fetchMock).toHaveBeenCalledWith('/api/v1/accounts', expect.objectContaining({
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
}));
|
||||
@@ -326,7 +326,7 @@ test('account cookie APIs include login_method when provided', async () => {
|
||||
});
|
||||
|
||||
await updateAccountCookie('acc1', 'unb=acc1; x=1', 'qr_scan');
|
||||
expect(fetchMock).toHaveBeenCalledWith('/cookies/acc1', expect.objectContaining({
|
||||
expect(fetchMock).toHaveBeenCalledWith('/api/v1/accounts/acc1', expect.objectContaining({
|
||||
method: 'PUT',
|
||||
credentials: 'include',
|
||||
}));
|
||||
@@ -382,7 +382,7 @@ test('updateAccountLoginInfo sends exactly provided fields', async () => {
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
|
||||
await updateAccountLoginInfo('acc1', { username: 'login-user', show_browser: false });
|
||||
expect(fetchMock).toHaveBeenCalledWith('/cookies/acc1/login-info', expect.objectContaining({
|
||||
expect(fetchMock).toHaveBeenCalledWith('/api/v1/accounts/acc1/login-info', expect.objectContaining({
|
||||
method: 'PUT',
|
||||
credentials: 'include',
|
||||
}));
|
||||
|
||||
@@ -48,7 +48,7 @@ export const updateLoginCredentials = async (data: {
|
||||
|
||||
// Accounts
|
||||
export const addAccount = async (id: string, value: string, loginMethod?: string): Promise<ApiResponse> => {
|
||||
return post('/cookies', { id, value, login_method: loginMethod });
|
||||
return post('/api/v1/accounts', { id, value, login_method: loginMethod });
|
||||
};
|
||||
|
||||
const accountAvatarURL = (item: AccountSummaryResponse, version: string): string => {
|
||||
@@ -207,7 +207,7 @@ export const updateAccountPauseDuration = async (id: string, pauseDuration: numb
|
||||
};
|
||||
|
||||
export const updateAccountCookie = async (id: string, value: string, loginMethod?: string): Promise<OperationResponse> => {
|
||||
return put(`/cookies/${id}`, { id, value, login_method: loginMethod });
|
||||
return put(`/api/v1/accounts/${id}`, { id, value, login_method: loginMethod });
|
||||
};
|
||||
|
||||
export interface AccountSettingsUpdate {
|
||||
@@ -286,7 +286,7 @@ export const updateAccountLoginInfo = async (id: string, data: {
|
||||
clear_password?: boolean;
|
||||
show_browser?: boolean;
|
||||
}): Promise<OperationResponse> => {
|
||||
return put(`/cookies/${id}/login-info`, data);
|
||||
return put(`/api/v1/accounts/${id}/login-info`, data);
|
||||
};
|
||||
|
||||
export const getAllAISettings = async (options?: RequestControlOptions): Promise<Record<string, AIReplySettings>> => {
|
||||
|
||||
Reference in new issue
Block a user