mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
fix(web): use generated account-profile contracts (#36927)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
3cd0da303a
commit
dea4e66456
34 files changed
+268
-151
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { AccountProfileResponse } from '@/contract/console/account'
|
||||
import type { GetAccountProfileResponse } from '@dify/contracts/api/console/account/types.gen'
|
||||
import { QueryClient } from '@tanstack/react-query'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { resolveServerConsoleApiUrl } from '@/service/server'
|
||||
@@ -18,7 +18,7 @@ vi.mock('@/next/headers', () => ({
|
||||
cookies: () => cookiesMock(),
|
||||
}))
|
||||
|
||||
const createProfile = (overrides: Partial<AccountProfileResponse> = {}): AccountProfileResponse => ({
|
||||
const createProfile = (overrides: Partial<GetAccountProfileResponse> = {}): GetAccountProfileResponse => ({
|
||||
id: 'account-id',
|
||||
name: 'Dify User',
|
||||
email: 'user@example.com',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { AccountProfileResponse } from '@/contract/console/account'
|
||||
import type { GetAccountProfileResponse } from '@dify/contracts/api/console/account/types.gen'
|
||||
import { queryOptions } from '@tanstack/react-query'
|
||||
import { IS_DEV } from '@/config'
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
@@ -6,7 +6,7 @@ import { get } from '@/service/base'
|
||||
import { consoleQuery } from '@/service/client'
|
||||
|
||||
export type UserProfileWithMeta = {
|
||||
profile: AccountProfileResponse
|
||||
profile: GetAccountProfileResponse
|
||||
meta: {
|
||||
currentVersion: string | null
|
||||
currentEnv: string | null
|
||||
@@ -24,7 +24,7 @@ export const userProfileQueryOptions = () =>
|
||||
needAllResponseContent: true,
|
||||
silent: true,
|
||||
})
|
||||
const profile: AccountProfileResponse = await response.clone().json()
|
||||
const profile: GetAccountProfileResponse = await response.clone().json()
|
||||
return {
|
||||
profile,
|
||||
meta: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { GetAccountProfileResponse } from '@dify/contracts/api/console/account/types.gen'
|
||||
import type { UserProfileWithMeta } from './client'
|
||||
import type { AccountProfileResponse } from '@/contract/console/account'
|
||||
import { queryOptions } from '@tanstack/react-query'
|
||||
import { getServerConsoleRequestHeaders, resolveServerConsoleApiUrl, serverConsoleQuery } from '@/service/server'
|
||||
|
||||
@@ -22,7 +22,7 @@ export const serverUserProfileQueryOptions = () =>
|
||||
if (!response.ok)
|
||||
throw response
|
||||
|
||||
const profile: AccountProfileResponse = await response.clone().json()
|
||||
const profile: GetAccountProfileResponse = await response.clone().json()
|
||||
return {
|
||||
profile,
|
||||
meta: {
|
||||
|
||||
Reference in new issue
Block a user