优化前端,删除冗余的withCredentials: true 和get_session_api_headers()

This commit is contained in:
jingrow 2026-01-25 01:06:43 +08:00
parent c915fe3892
commit bb379e6c6c
35 changed files with 55 additions and 273 deletions

View File

@ -169,7 +169,6 @@ import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
import { NInput, NSelect, NInputNumber, NDatePicker } from 'naive-ui'
import { t } from '@/shared/i18n'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
import { getRecords } from '@/shared/api/common'
interface FilterField {
@ -349,10 +348,7 @@ async function loadLinkDisplayValue(field: FilterField) {
}
// title_field
const response = await axios.get(`/api/data/${encodeURIComponent(field.options)}/${encodeURIComponent(currentValue)}`, {
headers: get_session_api_headers(),
withCredentials: true
})
const response = await axios.get(`/api/data/${encodeURIComponent(field.options)}/${encodeURIComponent(currentValue)}`)
const recordData = response.data?.data || {}
const titleValue = recordData[titleField] || currentValue
@ -382,10 +378,7 @@ async function getLinkPageTypeConfig(pagetype: string) {
}
try {
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, {
headers: get_session_api_headers(),
withCredentials: true
})
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`)
const config = response.data?.data || {}
linkDropdownStates.value[fieldName].pageTypeConfig = config

View File

@ -283,7 +283,6 @@ const TagSection = defineAsyncComponent(async () => {
})
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import { updateRecord, getRecord, getRecordAttachments, deleteAttachment, uploadAttachment, deleteRecords } from '@/shared/api/common'
import { downloadImageToLocal } from '@/shared/api/common'
import { usePageTypeSlug } from '@/shared/utils/slug'
@ -822,7 +821,7 @@ async function loadMeta() {
loading.value = true
try {
const url = `/api/data/PageType/${encodeURIComponent(entity.value)}`
const res = await axios.get(url, { headers: get_session_api_headers(), withCredentials: true })
const res = await axios.get(url)
const data = res.data?.data
metaFields.value = data?.fields || []
@ -1008,7 +1007,7 @@ async function handleSave() {
if (id.value.startsWith('new-')) {
recordData.__temporary_name = id.value
}
const response = await axios.post(url, recordData, { headers: get_session_api_headers(), withCredentials: true })
const response = await axios.post(url, recordData)
message.success(t('Created successfully'))
//
try { originalRecord.value = JSON.parse(JSON.stringify(record.value)) } catch { originalRecord.value = { ...record.value } }

View File

@ -412,7 +412,6 @@ import { NPagination, NModal, NInput, NButton, NCheckbox, NSelect, useMessage, u
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import { usePageTypeSlug } from '@/shared/utils/slug'
import { isSinglePageType } from '@/shared/utils/pagetype'
import DefaultSingle from '@/core/pagetype/default_single.vue'
@ -723,7 +722,7 @@ async function loadMeta() {
loading.value = true
try {
const url = `/api/data/PageType/${encodeURIComponent(entity.value)}`
const res = await axios.get(url, { headers: get_session_api_headers(), withCredentials: true })
const res = await axios.get(url)
const data = res.data?.data || {}
metaFields.value = data.fields || []
pageMeta.value = data // pageMetaimage_field
@ -748,10 +747,7 @@ async function getPageTypeConfig(pagetype: string) {
}
try {
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, {
headers: get_session_api_headers(),
withCredentials: true
})
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`)
const config = response.data?.data || {}
pageTypeConfigCache.value[pagetype] = config
@ -821,9 +817,7 @@ async function preloadLinkTitles() {
fields: JSON.stringify(fields),
filters: JSON.stringify(filters),
limit_page_length: namesToLoad.length
},
headers: get_session_api_headers(),
withCredentials: true
}
})
// 使LRU
@ -945,9 +939,7 @@ async function loadData() {
fields: JSON.stringify(['name']),
filters: JSON.stringify(searchFilters),
limit_page_length: 100 // 100
},
headers: get_session_api_headers(),
withCredentials: true
}
})
const matchedRecords = searchResult.data?.data || []
@ -971,9 +963,7 @@ async function loadData() {
fields: JSON.stringify(['name']),
filters: JSON.stringify(searchFilters),
limit_page_length: 100
},
headers: get_session_api_headers(),
withCredentials: true
}
})
const matchedRecords = searchResult.data?.data || []
@ -1006,8 +996,7 @@ async function loadData() {
}
const res = await axios.get(listUrl, {
params,
headers: get_session_api_headers(), withCredentials: true
params
})
rows.value = res.data?.data || []
// total
@ -1213,9 +1202,7 @@ async function loadModules() {
fields: JSON.stringify(['name']),
order_by: 'name asc',
limit_page_length: 1000
},
headers: get_session_api_headers(),
withCredentials: true
}
})
const modules = response.data?.data || []
@ -1242,9 +1229,7 @@ async function loadPackages() {
fields: JSON.stringify(['name']),
order_by: 'name asc',
limit_page_length: 1000
},
headers: get_session_api_headers(),
withCredentials: true
}
})
const packages = response.data?.data || []
@ -1309,13 +1294,7 @@ async function handleCreatePageType() {
console.log('[CreatePageType] 创建数据:', createData)
const res = await axios.post(
`/api/data/PageType`,
createData,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/api/data/PageType`, createData)
console.log('[CreatePageType] API响应:', res)
console.log('[CreatePageType] 响应data:', res.data)

View File

@ -420,7 +420,6 @@ import JeditorControl from '@/core/pagetype/form/controls/Jeditor.vue'
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import { usePageTypeSlug } from '@/shared/utils/slug'
import { getSinglePageData, saveSinglePageData } from '@/shared/utils/pagetype'
@ -809,7 +808,7 @@ async function loadMeta() {
loading.value = true
try {
const url = `/api/data/PageType/${encodeURIComponent(entity.value)}`
const res = await axios.get(url, { headers: get_session_api_headers(), withCredentials: true })
const res = await axios.get(url)
const data = res.data?.data
metaFields.value = data?.fields || []

View File

@ -5,7 +5,6 @@ import { Icon } from '@iconify/vue'
import { getRecords } from '@/shared/api/common'
import { pageTypeToSlug } from '@/shared/utils/slug'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
import { t } from '@/shared/i18n'
const props = defineProps<{ df: any; record: Record<string, any>; canEdit: boolean; ctx: any }>()
@ -59,10 +58,7 @@ async function getPageTypeConfig(pagetype: string) {
}
try {
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, {
headers: get_session_api_headers(),
withCredentials: true
})
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`)
const config = response.data?.data || {}
pageTypeConfig.value[pagetype] = config
@ -102,10 +98,7 @@ async function getRecordTitle(pagetype: string, recordName: string) {
}
//
const response = await axios.get(`/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(recordName)}`, {
headers: get_session_api_headers(),
withCredentials: true
})
const response = await axios.get(`/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(recordName)}`)
const recordData = response.data?.data || {}
const titleValue = recordData[titleField] || recordName

View File

@ -4,7 +4,6 @@ import { NModal, NButton, NSpace, NIcon, NTag } from 'naive-ui'
import FieldRenderer from '@/core/pagetype/form/FieldRenderer.vue'
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
const props = defineProps<{
df: any;
@ -220,7 +219,7 @@ async function loadChildMeta() {
if (!pagetype) return
loading.value = true
try {
const res = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}` , { headers: get_session_api_headers(), withCredentials: true })
const res = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}` )
const fields: Field[] = res.data?.data?.fields || []
childFields.value = fields
} finally {

View File

@ -187,11 +187,3 @@ export const signupApi = async (data: SignupRequest): Promise<SignupResponse> =>
}
}
}
// 仅使用会话Cookie的最小鉴权头部不影响现有API Key逻辑
export function get_session_api_headers() {
return {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
}

View File

@ -1,5 +1,4 @@
import axios from 'axios'
import { get_session_api_headers } from './auth'
// 统一使用相对路径,通过 Vite 代理转发到后端
@ -17,8 +16,6 @@ export const deleteRecords = async (pagetype: string, names: string[]): Promise<
names: names
},
{
headers: get_session_api_headers(),
withCredentials: true,
validateStatus: (status) => status === 200 || status === 207 // 允许207状态码
}
)
@ -40,13 +37,7 @@ export const deleteRecords = async (pagetype: string, names: string[]): Promise<
export const createRecord = async (pagetype: string, data: Record<string, any>): Promise<{ success: boolean; data?: any; message?: string }> => {
try {
const response = await axios.post(
`/api/data/${pagetype}`,
data,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/api/data/${pagetype}`, data)
const message = response.data?.message
return { success: true, data: message || response.data, message: 'Created successfully' }
@ -59,13 +50,7 @@ export const createRecord = async (pagetype: string, data: Record<string, any>):
export const updateRecord = async (pagetype: string, name: string, data: Record<string, any>): Promise<{ success: boolean; data?: any; message?: string }> => {
try {
const response = await axios.put(
`/api/data/${pagetype}/${name}`,
data,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/api/data/${pagetype}/${name}`, data)
const message = response.data?.message
return { success: true, data: message || response.data, message: 'Updated successfully' }
@ -78,12 +63,7 @@ export const updateRecord = async (pagetype: string, name: string, data: Record<
export const getRecord = async (pagetype: string, name: string): Promise<{ success: boolean; data?: any; message?: string }> => {
try {
const response = await axios.get(
`/api/data/${pagetype}/${name}`,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/api/data/${pagetype}/${name}`)
return { success: true, data: response.data.data }
} catch (error: any) {
return { success: false, message: error.response?.data?.message || error.message || '获取失败' }
@ -102,9 +82,7 @@ export const getRecordAttachments = async (pagetype: string, name: string): Prom
attached_to_name: name
}),
fields: JSON.stringify(['name', 'file_name', 'file_url', 'is_private'])
},
headers: get_session_api_headers(),
withCredentials: true
}
}
)
return { success: true, data: response.data.data || [] }
@ -133,10 +111,8 @@ export const uploadAttachment = async (
formData,
{
headers: {
...get_session_api_headers(),
'Content-Type': 'multipart/form-data'
},
withCredentials: true
}
}
)
@ -153,12 +129,7 @@ export const uploadAttachment = async (
export const deleteAttachment = async (attachmentName: string): Promise<{ success: boolean; message?: string }> => {
try {
await axios.delete(
`/api/data/File/${attachmentName}`,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/api/data/File/${attachmentName}`)
return { success: true, message: '附件删除成功' }
} catch (error: any) {
return { success: false, message: error.response?.data?.message || error.message || '删除附件失败' }
@ -179,9 +150,7 @@ export const getCount = async (pagetype: string): Promise<{ success: boolean; co
{
params: {
pagetype: pagetype
},
headers: get_session_api_headers(),
withCredentials: true
}
}
)
@ -200,12 +169,7 @@ export const getCount = async (pagetype: string): Promise<{ success: boolean; co
export const getLocalJobCount = async (): Promise<{ success: boolean; count?: number; message?: string }> => {
try {
const response = await axios.get(
`/jingrow/local-job-count`,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/jingrow/local-job-count`)
const count = response.data?.count || 0
return {
@ -234,9 +198,7 @@ export const getRecords = async (pagetype: string, filters: any[] = [], fields:
order_by: orderBy,
limit_start: limitStart,
limit_page_length: limitPageLength
},
headers: get_session_api_headers(),
withCredentials: true
}
}
)
@ -272,8 +234,6 @@ export const downloadImageToLocal = async (
filename: filename
},
{
headers: get_session_api_headers(),
withCredentials: true,
timeout: 30000
}
)
@ -325,10 +285,8 @@ export const uploadFileToJingrow = async (
formData,
{
headers: {
...get_session_api_headers(),
'Content-Type': 'multipart/form-data'
},
withCredentials: true,
timeout: 30000
}
)

View File

@ -1,17 +1,10 @@
import axios from 'axios'
import { get_session_api_headers } from './auth'
// 内部函数调用文本转向量API
const callEmbeddingApi = async (texts: string[]) => {
try {
const response = await axios.post(
`/jingrow/embedding/batch`,
{ texts },
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/jingrow/embedding/batch`, { texts })
return {
success: true,
@ -43,8 +36,6 @@ const searchVectors = async (
score_threshold: scoreThreshold
},
{
headers: get_session_api_headers(),
withCredentials: true
}
)

View File

@ -1,5 +1,4 @@
import axios from 'axios'
import { get_session_api_headers } from './auth'
// 统一使用相对路径,通过 Vite 代理转发到后端
@ -7,9 +6,7 @@ import { get_session_api_headers } from './auth'
export const getNodeSchemaFields = async (nodeType: string): Promise<any[]> => {
try {
const response = await axios.get(
`/jingrow/node/schema-fields/${encodeURIComponent(nodeType)}`,
{ headers: get_session_api_headers(), withCredentials: true }
)
`/jingrow/node/schema-fields/${encodeURIComponent(nodeType)}`)
return response.data?.fields || []
} catch (error) {
console.error('获取节点Schema字段失败:', error)
@ -21,10 +18,7 @@ export const getNodeSchemaFields = async (nodeType: string): Promise<any[]> => {
export const importLocalNodes = async (): Promise<{ success: boolean; matched: number; imported: number; skipped_existing: number; errors?: string[] }> => {
try {
const response = await axios.post(
`/jingrow/node/import-local`,
{},
{ headers: get_session_api_headers(), withCredentials: true }
)
`/jingrow/node/import-local`, {})
return response.data
} catch (error) {
console.error('导入本地节点失败:', error)
@ -38,9 +32,7 @@ export const packageNode = async (nodeType: string): Promise<{ blob: Blob; filen
const response = await axios.post(
`/jingrow/node/package/${encodeURIComponent(nodeType)}`,
{},
{
headers: get_session_api_headers(),
withCredentials: true,
{
responseType: 'blob'
}
)
@ -96,10 +88,8 @@ export const publishNodeToMarketplace = async (data: {
formData,
{
headers: {
...get_session_api_headers(),
'Content-Type': 'multipart/form-data'
},
withCredentials: true
}
}
)
return response.data

View File

@ -1,5 +1,4 @@
import axios from 'axios'
import { get_session_api_headers } from './auth'
export interface EnvironmentConfig {
jingrow_server_url: string
@ -32,12 +31,7 @@ export interface EnvironmentConfig {
export const getEnvironmentConfig = async (): Promise<{ success: boolean; data?: EnvironmentConfig; message?: string }> => {
try {
const response = await axios.get(
`/jingrow/system/environment-config`,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/jingrow/system/environment-config`)
if (response.data?.success) {
return { success: true, data: response.data.data }
@ -58,13 +52,7 @@ export const getEnvironmentConfig = async (): Promise<{ success: boolean; data?:
export const updateEnvironmentConfig = async (config: Partial<EnvironmentConfig>): Promise<{ success: boolean; message?: string }> => {
try {
const response = await axios.post(
`/jingrow/system/environment-config`,
config,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/jingrow/system/environment-config`, config)
if (response.data?.success) {
return { success: true, message: response.data.message || '环境配置已更新' }
@ -85,13 +73,7 @@ export const updateEnvironmentConfig = async (config: Partial<EnvironmentConfig>
export const restartEnvironment = async (): Promise<{ success: boolean; message?: string }> => {
try {
const response = await axios.post(
`/jingrow/system/restart-environment`,
{},
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/jingrow/system/restart-environment`, {})
if (response.data?.success) {
return { success: true, message: response.data.message || '环境重启请求已提交' }

View File

@ -4,7 +4,6 @@ import type { Router } from 'vue-router'
import axios from 'axios'
import { t } from '../i18n'
import { registerToolRoute, unregisterToolRoute, registerAllToolRoutes, ensureToolRoutes } from '../utils/dynamicRoutes'
import { get_session_api_headers } from '../api/auth'
export interface Tool {
id: string
@ -175,8 +174,7 @@ export const useToolsStore = defineStore('tools', () => {
try {
await axios.post(`/jingrow/uninstall-tool/${toolName}`, {}, {
headers: {
...get_session_api_headers()
}
}
})
} catch (error: any) {
console.error('删除工具文件失败:', error.response?.data || error.message || '未知错误')

View File

@ -1,5 +1,4 @@
import axios from 'axios'
import { get_session_api_headers } from '../api/auth'
/**
* pagetype
@ -9,10 +8,7 @@ import { get_session_api_headers } from '../api/auth'
export async function isSinglePageType(entity: string): Promise<boolean> {
try {
const url = `/api/data/PageType/${encodeURIComponent(entity)}`
const res = await axios.get(url, {
headers: get_session_api_headers(),
withCredentials: true
})
const res = await axios.get(url)
const data = res.data?.data
// 检查 issingle 字段,如果为 1 或 true 则认为是单页模式
@ -41,10 +37,7 @@ export async function getPageTypeRouteName(entity: string): Promise<string> {
export async function getSinglePageData(pagetype: string): Promise<{ success: boolean; data?: any; message?: string }> {
try {
const url = `/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(pagetype)}`
const res = await axios.get(url, {
headers: get_session_api_headers(),
withCredentials: true
})
const res = await axios.get(url)
if (res.data?.data) {
return {
@ -75,10 +68,7 @@ export async function getSinglePageData(pagetype: string): Promise<{ success: bo
export async function saveSinglePageData(pagetype: string, data: any): Promise<{ success: boolean; message?: string }> {
try {
const url = `/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(pagetype)}`
await axios.put(url, data, {
headers: get_session_api_headers(),
withCredentials: true
})
await axios.put(url, data)
return {
success: true

View File

@ -128,7 +128,6 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { get_session_api_headers } from '@/shared/api/auth'
import { NButton, NIcon, NSpin, NEmpty, useMessage, useDialog } from 'naive-ui'
import { Icon } from '@iconify/vue'
import axios from 'axios'
@ -269,7 +268,6 @@ async function performInstall() {
agent_flow: agentFlow
}, {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/json'
}
})

View File

@ -152,7 +152,6 @@ import { NInput, NButton, NIcon, NSpin, NEmpty, NSelect, NPagination, useMessage
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import InstallProgressModal from './InstallProgressModal.vue'
const message = useMessage()
@ -316,7 +315,6 @@ async function performInstall(agent: any) {
agent_flow: agentFlow
}, {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/json'
}
})

View File

@ -134,7 +134,6 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { get_session_api_headers } from '@/shared/api/auth'
import { NButton, NIcon, NSpin, NEmpty, useMessage, useDialog } from 'naive-ui'
import { Icon } from '@iconify/vue'
import axios from 'axios'
@ -275,7 +274,6 @@ async function performInstall() {
url: app.value.file_url
}), {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})
@ -292,7 +290,6 @@ async function performInstall() {
response = await axios.post('/jingrow/install-from-git', params, {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})

View File

@ -130,7 +130,6 @@ import {
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { useRouter } from 'vue-router'
import { get_session_api_headers } from '@/shared/api/auth'
import { t } from '@/shared/i18n'
const fileList = ref<UploadFileInfo[]>([])
@ -243,7 +242,6 @@ const startUpload = async () => {
installMessage.value = t('Uploading file...')
const response = await axios.post(apiEndpoint, formData, {
headers: {
...get_session_api_headers(),
'Content-Type': 'multipart/form-data'
},
onUploadProgress: (progressEvent) => {
@ -301,10 +299,7 @@ const loadLocalApps = async () => {
loadingLocalApps.value = true
try {
const base = (import.meta as any).env.VITE_LOCAL_API_URL || ''
const response = await axios.get(`${base}/jingrow/local-apps`, {
headers: get_session_api_headers(),
withCredentials: true
})
const response = await axios.get(`${base}/jingrow/local-apps`)
if (response.data.success) {
localApps.value = response.data.data.apps
@ -321,10 +316,7 @@ const loadLocalApps = async () => {
const installLocalApp = async (appName: string) => {
try {
const base = (import.meta as any).env.VITE_LOCAL_API_URL || ''
const response = await axios.post(`${base}/jingrow/install-local/${appName}`, {}, {
headers: get_session_api_headers(),
withCredentials: true
})
const response = await axios.post(`${base}/jingrow/install-local/${appName}`)
if (response.data.success) {
message.success(t('App \'{0}\' installed successfully').replace('{0}', appName))

View File

@ -160,7 +160,6 @@ import { NInput, NButton, NIcon, NSpin, NEmpty, NSelect, NPagination, useMessage
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import InstallProgressModal from './InstallProgressModal.vue'
const message = useMessage()
@ -303,7 +302,6 @@ async function performInstall(app: any) {
url: app.file_url
}), {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})
@ -320,7 +318,6 @@ async function performInstall(app: any) {
response = await axios.post('/jingrow/install-from-git', params, {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})

View File

@ -65,7 +65,6 @@ import { ref, computed } from 'vue'
import { NCard, NForm, NFormItem, NSelect, NSwitch, NButton, NSpace, NCheckbox, NCheckboxGroup, useMessage, type FormInst, type FormRules } from 'naive-ui'
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
const message = useMessage()
@ -150,7 +149,7 @@ async function onDropdownShow(shown: boolean) {
if (!shown || pagetypeOptions.value.length) return
loading.value = true
try {
const res = await axios.get(`/api/data/PageType`, { params: { order_by: 'modified desc', limit_page_length: 1000 }, headers: get_session_api_headers(), withCredentials: true })
const res = await axios.get(`/api/data/PageType`, { params: { order_by: 'modified desc', limit_page_length: 1000 } })
const list = res.data?.data || []
pagetypeOptions.value = list.map((x: any) => ({ label: x.name, value: x.name }))
} catch (e: any) {
@ -190,9 +189,7 @@ async function onPagetypeChange() {
if (!form.value.pagetype) return
try {
const res = await axios.get(`/jingrow/get-module-app`, {
params: { pagetype: form.value.pagetype },
headers: get_session_api_headers(),
withCredentials: true
params: { pagetype: form.value.pagetype }
})
const msg = res.data?.message || {}
if (msg?.success) {
@ -217,7 +214,7 @@ async function handleSubmit() {
create_backend: form.value.createBackend,
frontend_options: form.value.frontendOptions || [],
field_type_names: form.value.fieldTypeNames || []
}, { headers: get_session_api_headers(), withCredentials: true })
}, {})
result.value = res.data
if (res.data?.success) {
const { frontend_exists, backend_exists } = res.data

View File

@ -44,7 +44,6 @@ import {
} from 'naive-ui'
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
import { t } from '@/shared/i18n'
//
@ -105,9 +104,7 @@ const loadInstalledApps = async () => {
try {
loadingApps.value = true
const response = await axios.get('/jingrow/installed-apps', {
headers: get_session_api_headers()
})
const response = await axios.get('/jingrow/installed-apps')
if (response.data.success) {
installedApps.value = response.data.data.apps || []
@ -137,9 +134,7 @@ const exportApp = async (app: any) => {
try {
exporting.value = app.name
const response = await axios.post(`/jingrow/export-app-package/${app.name}`, {}, {
headers: get_session_api_headers()
})
const response = await axios.post(`/jingrow/export-app-package/${app.name}`, {})
if (response.data.success) {
message.success(t('App package exported successfully: {0}').replace('{0}', response.data.filename || app.name))
@ -175,9 +170,7 @@ const uninstallApp = async (app: any) => {
try {
uninstalling.value = true
const response = await axios.post(`/jingrow/uninstall/${app.name}`, {}, {
headers: get_session_api_headers()
})
const response = await axios.post(`/jingrow/uninstall/${app.name}`, {})
if (response.data.success) {
message.success(t('App \'{0}\' uninstalled successfully').replace('{0}', app.name))

View File

@ -253,8 +253,6 @@ async function performDelete(agentName: string) {
// API
const response = await axios.post('/jingrow/delete-published-agent', {
name: agentName
}, {
withCredentials: true
})
if (response.data && response.data.success) {

View File

@ -284,8 +284,6 @@ async function performDelete(appName: string) {
// API
const response = await axios.post('/jingrow/delete-published-app', {
name: appName
}, {
withCredentials: true
})
if (response.data && response.data.success) {

View File

@ -257,8 +257,6 @@ async function performDelete(nodeName: string) {
// API
const response = await axios.post('/jingrow/delete-published-node', {
name: nodeName
}, {
withCredentials: true
})
if (response.data && response.data.success) {

View File

@ -284,8 +284,6 @@ async function performDelete(toolName: string) {
// API
const response = await axios.post('/jingrow/delete-published-tool', {
name: toolName
}, {
withCredentials: true
})
if (response.data && response.data.success) {

View File

@ -137,7 +137,6 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { get_session_api_headers } from '@/shared/api/auth'
import { NButton, NIcon, NSpin, NEmpty, useMessage, useDialog } from 'naive-ui'
import { Icon } from '@iconify/vue'
import axios from 'axios'
@ -267,7 +266,6 @@ async function performInstall() {
url: node.value.file_url
}), {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})
@ -284,7 +282,6 @@ async function performInstall() {
response = await axios.post('/jingrow/install-node-from-git', params, {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})

View File

@ -157,7 +157,6 @@ import { NInput, NButton, NIcon, NSpin, NEmpty, NSelect, NPagination, useMessage
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import InstallProgressModal from './InstallProgressModal.vue'
const message = useMessage()
@ -296,7 +295,6 @@ async function performInstall(node: any) {
url: node.file_url
}), {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})
@ -313,7 +311,6 @@ async function performInstall(node: any) {
response = await axios.post('/jingrow/install-node-from-git', params, {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})

View File

@ -142,7 +142,6 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { get_session_api_headers } from '@/shared/api/auth'
import { NButton, NIcon, NSpin, NEmpty, useMessage } from 'naive-ui'
import { Icon } from '@iconify/vue'
import axios from 'axios'
@ -269,7 +268,6 @@ async function performInstall() {
url: tool.value.file_url
}), {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})

View File

@ -161,7 +161,6 @@ import { NInput, NButton, NIcon, NSpin, NEmpty, NSelect, NPagination, useMessage
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import { useToolsStore } from '@/shared/stores/tools'
import InstallProgressModal from './InstallProgressModal.vue'
@ -282,7 +281,6 @@ async function performInstall(tool: any) {
tool_name: tool.name || tool.tool_name
}), {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded'
}
})

View File

@ -35,7 +35,6 @@
import { ref, computed } from 'vue'
import { useMessage } from 'naive-ui'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
const props = defineProps<{
context: {
@ -103,10 +102,7 @@ async function handleFlowBuilder() {
} else {
// API agent_flow
try {
const response = await axios.get(`/api/data/${encodeURIComponent(props.context.entity)}/${encodeURIComponent(agentId)}`, {
headers: get_session_api_headers(),
withCredentials: true
})
const response = await axios.get(`/api/data/${encodeURIComponent(props.context.entity)}/${encodeURIComponent(agentId)}`)
const record = response.data?.data || {}
const raw = record.agent_flow ?? {}

View File

@ -125,7 +125,6 @@ import { Icon } from '@iconify/vue'
import { useRouter } from 'vue-router'
import { t } from '@/shared/i18n'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
interface Props {
entity: string
@ -292,10 +291,8 @@ async function performPublish() {
const response = await axios.post('/jingrow/agent/publish', publishData, {
headers: {
...get_session_api_headers(),
'Content-Type': 'application/json'
},
withCredentials: true
}
})
if (response.data.success) {

View File

@ -40,7 +40,6 @@ import { ref, computed } from 'vue'
import { Teleport } from 'vue'
import { useMessage } from 'naive-ui'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
import { t } from '@/shared/i18n'
import SchemaEditorModal from '@/core/components/SchemaEditorModal.vue'
@ -137,12 +136,7 @@ async function handleOpenSchemaEditor() {
if (!row.value?.node_schema) {
try {
const response = await axios.get(
`/api/data/${encodeURIComponent(entity.value)}/${encodeURIComponent(nodeName.value)}`,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
`/api/data/${encodeURIComponent(entity.value)}/${encodeURIComponent(nodeName.value)}`)
const record = response.data?.data || {}
// row 便使
@ -163,15 +157,9 @@ async function handleSchemaSave(schemaData: any) {
try {
// Schema
const response = await axios.put(
`/api/data/${encodeURIComponent(entity.value)}/${encodeURIComponent(nodeName.value)}`,
{
`/api/data/${encodeURIComponent(entity.value)}/${encodeURIComponent(nodeName.value)}`, {
node_schema: schemaData
},
{
headers: get_session_api_headers(),
withCredentials: true
}
)
})
if (response.data?.success !== false) {
// row

View File

@ -132,7 +132,6 @@ import { t } from '@/shared/i18n'
import SchemaEditorModal from '@/core/components/SchemaEditorModal.vue'
import PublishProgressModal, { type Step } from './PublishProgressModal.vue'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
import { packageNode, publishNodeToMarketplace } from '@/shared/api/nodes'
import { uploadFileToJingrow } from '@/shared/api/common'
@ -208,15 +207,9 @@ async function handleSchemaSave(schemaData: any) {
try {
// Schema
const response = await axios.put(
`/api/data/${encodeURIComponent(props.entity)}/${encodeURIComponent(nodeName.value)}`,
{
`/api/data/${encodeURIComponent(props.entity)}/${encodeURIComponent(nodeName.value)}`, {
node_schema: schemaData
},
{
headers: get_session_api_headers(),
withCredentials: true
}
)
})
if (response.data?.success !== false) {
//

View File

@ -69,7 +69,6 @@ import { ref } from 'vue'
import { NButton, NSpace, NIcon, NModal, NCard, useDialog, useMessage } from 'naive-ui'
import { Icon } from '@iconify/vue'
import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
const props = defineProps<{
context: {
@ -111,9 +110,7 @@ const uninstallPackage = async (packageName: string) => {
uninstalling.value = true
// API
const response = await axios.post(`/jingrow/uninstall-extension/${packageName}`, {}, {
headers: get_session_api_headers()
})
const response = await axios.post(`/jingrow/uninstall-extension/${packageName}`, {})
if (response.data.success) {
message.success(props.context.t("Package '{0}' uninstalled successfully").replace('{0}', packageName))
@ -138,8 +135,6 @@ const showResources = async () => {
const response = await axios.post('/jingrow/get-package-dependencies', {
package_name: packageName
}, {
headers: get_session_api_headers()
})
if (response.data.message.status === 'success') {

View File

@ -131,7 +131,6 @@ import { useRouter } from 'vue-router'
import { t } from '../../shared/i18n'
import { NInput, NSelect, NPagination, NCheckbox, useMessage } from 'naive-ui'
import axios from 'axios'
import { get_session_api_headers } from '../../shared/api/auth'
import {
getScheduledJobs,
toggleScheduledJobStatus
@ -319,9 +318,7 @@ function getGridTemplateColumns(): string {
async function loadMetaFields() {
try {
const response = await axios.get(
`/api/data/PageType/${encodeURIComponent('Local Scheduled Job')}`,
{ headers: get_session_api_headers(), withCredentials: true }
)
`/api/data/PageType/${encodeURIComponent('Local Scheduled Job')}`)
const data = response.data?.data || {}
metaFields.value = data.fields || []

View File

@ -188,7 +188,6 @@ import { useMessage } from 'naive-ui'
import { useRoute } from 'vue-router'
import axios from 'axios'
import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import { useAuthStore } from '@/shared/stores/auth'
import { useSEO } from '@/shared/composables/useSEO'
import { compressImageFile } from '@/shared/utils/imageResize'