优化前端,删除冗余的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 { NInput, NSelect, NInputNumber, NDatePicker } from 'naive-ui'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
import axios from 'axios' import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
import { getRecords } from '@/shared/api/common' import { getRecords } from '@/shared/api/common'
interface FilterField { interface FilterField {
@ -349,10 +348,7 @@ async function loadLinkDisplayValue(field: FilterField) {
} }
// title_field // title_field
const response = await axios.get(`/api/data/${encodeURIComponent(field.options)}/${encodeURIComponent(currentValue)}`, { const response = await axios.get(`/api/data/${encodeURIComponent(field.options)}/${encodeURIComponent(currentValue)}`)
headers: get_session_api_headers(),
withCredentials: true
})
const recordData = response.data?.data || {} const recordData = response.data?.data || {}
const titleValue = recordData[titleField] || currentValue const titleValue = recordData[titleField] || currentValue
@ -382,10 +378,7 @@ async function getLinkPageTypeConfig(pagetype: string) {
} }
try { try {
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, { const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`)
headers: get_session_api_headers(),
withCredentials: true
})
const config = response.data?.data || {} const config = response.data?.data || {}
linkDropdownStates.value[fieldName].pageTypeConfig = config linkDropdownStates.value[fieldName].pageTypeConfig = config

View File

@ -283,7 +283,6 @@ const TagSection = defineAsyncComponent(async () => {
}) })
import axios from 'axios' import axios from 'axios'
import { t } from '@/shared/i18n' 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 { updateRecord, getRecord, getRecordAttachments, deleteAttachment, uploadAttachment, deleteRecords } from '@/shared/api/common'
import { downloadImageToLocal } from '@/shared/api/common' import { downloadImageToLocal } from '@/shared/api/common'
import { usePageTypeSlug } from '@/shared/utils/slug' import { usePageTypeSlug } from '@/shared/utils/slug'
@ -822,7 +821,7 @@ async function loadMeta() {
loading.value = true loading.value = true
try { try {
const url = `/api/data/PageType/${encodeURIComponent(entity.value)}` 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 const data = res.data?.data
metaFields.value = data?.fields || [] metaFields.value = data?.fields || []
@ -1008,7 +1007,7 @@ async function handleSave() {
if (id.value.startsWith('new-')) { if (id.value.startsWith('new-')) {
recordData.__temporary_name = id.value 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')) message.success(t('Created successfully'))
// //
try { originalRecord.value = JSON.parse(JSON.stringify(record.value)) } catch { originalRecord.value = { ...record.value } } 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 { Icon } from '@iconify/vue'
import axios from 'axios' import axios from 'axios'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import { usePageTypeSlug } from '@/shared/utils/slug' import { usePageTypeSlug } from '@/shared/utils/slug'
import { isSinglePageType } from '@/shared/utils/pagetype' import { isSinglePageType } from '@/shared/utils/pagetype'
import DefaultSingle from '@/core/pagetype/default_single.vue' import DefaultSingle from '@/core/pagetype/default_single.vue'
@ -723,7 +722,7 @@ async function loadMeta() {
loading.value = true loading.value = true
try { try {
const url = `/api/data/PageType/${encodeURIComponent(entity.value)}` 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 || {} const data = res.data?.data || {}
metaFields.value = data.fields || [] metaFields.value = data.fields || []
pageMeta.value = data // pageMetaimage_field pageMeta.value = data // pageMetaimage_field
@ -748,10 +747,7 @@ async function getPageTypeConfig(pagetype: string) {
} }
try { try {
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, { const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`)
headers: get_session_api_headers(),
withCredentials: true
})
const config = response.data?.data || {} const config = response.data?.data || {}
pageTypeConfigCache.value[pagetype] = config pageTypeConfigCache.value[pagetype] = config
@ -821,9 +817,7 @@ async function preloadLinkTitles() {
fields: JSON.stringify(fields), fields: JSON.stringify(fields),
filters: JSON.stringify(filters), filters: JSON.stringify(filters),
limit_page_length: namesToLoad.length limit_page_length: namesToLoad.length
}, }
headers: get_session_api_headers(),
withCredentials: true
}) })
// 使LRU // 使LRU
@ -945,9 +939,7 @@ async function loadData() {
fields: JSON.stringify(['name']), fields: JSON.stringify(['name']),
filters: JSON.stringify(searchFilters), filters: JSON.stringify(searchFilters),
limit_page_length: 100 // 100 limit_page_length: 100 // 100
}, }
headers: get_session_api_headers(),
withCredentials: true
}) })
const matchedRecords = searchResult.data?.data || [] const matchedRecords = searchResult.data?.data || []
@ -971,9 +963,7 @@ async function loadData() {
fields: JSON.stringify(['name']), fields: JSON.stringify(['name']),
filters: JSON.stringify(searchFilters), filters: JSON.stringify(searchFilters),
limit_page_length: 100 limit_page_length: 100
}, }
headers: get_session_api_headers(),
withCredentials: true
}) })
const matchedRecords = searchResult.data?.data || [] const matchedRecords = searchResult.data?.data || []
@ -1006,8 +996,7 @@ async function loadData() {
} }
const res = await axios.get(listUrl, { const res = await axios.get(listUrl, {
params, params
headers: get_session_api_headers(), withCredentials: true
}) })
rows.value = res.data?.data || [] rows.value = res.data?.data || []
// total // total
@ -1213,9 +1202,7 @@ async function loadModules() {
fields: JSON.stringify(['name']), fields: JSON.stringify(['name']),
order_by: 'name asc', order_by: 'name asc',
limit_page_length: 1000 limit_page_length: 1000
}, }
headers: get_session_api_headers(),
withCredentials: true
}) })
const modules = response.data?.data || [] const modules = response.data?.data || []
@ -1242,9 +1229,7 @@ async function loadPackages() {
fields: JSON.stringify(['name']), fields: JSON.stringify(['name']),
order_by: 'name asc', order_by: 'name asc',
limit_page_length: 1000 limit_page_length: 1000
}, }
headers: get_session_api_headers(),
withCredentials: true
}) })
const packages = response.data?.data || [] const packages = response.data?.data || []
@ -1309,13 +1294,7 @@ async function handleCreatePageType() {
console.log('[CreatePageType] 创建数据:', createData) console.log('[CreatePageType] 创建数据:', createData)
const res = await axios.post( const res = await axios.post(
`/api/data/PageType`, `/api/data/PageType`, createData)
createData,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
console.log('[CreatePageType] API响应:', res) console.log('[CreatePageType] API响应:', res)
console.log('[CreatePageType] 响应data:', res.data) 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 { Icon } from '@iconify/vue'
import axios from 'axios' import axios from 'axios'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import { usePageTypeSlug } from '@/shared/utils/slug' import { usePageTypeSlug } from '@/shared/utils/slug'
import { getSinglePageData, saveSinglePageData } from '@/shared/utils/pagetype' import { getSinglePageData, saveSinglePageData } from '@/shared/utils/pagetype'
@ -809,7 +808,7 @@ async function loadMeta() {
loading.value = true loading.value = true
try { try {
const url = `/api/data/PageType/${encodeURIComponent(entity.value)}` 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 const data = res.data?.data
metaFields.value = data?.fields || [] metaFields.value = data?.fields || []

View File

@ -5,7 +5,6 @@ import { Icon } from '@iconify/vue'
import { getRecords } from '@/shared/api/common' import { getRecords } from '@/shared/api/common'
import { pageTypeToSlug } from '@/shared/utils/slug' import { pageTypeToSlug } from '@/shared/utils/slug'
import axios from 'axios' import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
const props = defineProps<{ df: any; record: Record<string, any>; canEdit: boolean; ctx: any }>() const props = defineProps<{ df: any; record: Record<string, any>; canEdit: boolean; ctx: any }>()
@ -59,10 +58,7 @@ async function getPageTypeConfig(pagetype: string) {
} }
try { try {
const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`, { const response = await axios.get(`/api/data/PageType/${encodeURIComponent(pagetype)}`)
headers: get_session_api_headers(),
withCredentials: true
})
const config = response.data?.data || {} const config = response.data?.data || {}
pageTypeConfig.value[pagetype] = config 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)}`, { const response = await axios.get(`/api/data/${encodeURIComponent(pagetype)}/${encodeURIComponent(recordName)}`)
headers: get_session_api_headers(),
withCredentials: true
})
const recordData = response.data?.data || {} const recordData = response.data?.data || {}
const titleValue = recordData[titleField] || recordName 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 FieldRenderer from '@/core/pagetype/form/FieldRenderer.vue'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
import axios from 'axios' import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
const props = defineProps<{ const props = defineProps<{
df: any; df: any;
@ -220,7 +219,7 @@ async function loadChildMeta() {
if (!pagetype) return if (!pagetype) return
loading.value = true loading.value = true
try { 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 || [] const fields: Field[] = res.data?.data?.fields || []
childFields.value = fields childFields.value = fields
} finally { } 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 axios from 'axios'
import { get_session_api_headers } from './auth'
// 统一使用相对路径,通过 Vite 代理转发到后端 // 统一使用相对路径,通过 Vite 代理转发到后端
@ -17,8 +16,6 @@ export const deleteRecords = async (pagetype: string, names: string[]): Promise<
names: names names: names
}, },
{ {
headers: get_session_api_headers(),
withCredentials: true,
validateStatus: (status) => status === 200 || status === 207 // 允许207状态码 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 }> => { export const createRecord = async (pagetype: string, data: Record<string, any>): Promise<{ success: boolean; data?: any; message?: string }> => {
try { try {
const response = await axios.post( const response = await axios.post(
`/api/data/${pagetype}`, `/api/data/${pagetype}`, data)
data,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
const message = response.data?.message const message = response.data?.message
return { success: true, data: message || response.data, message: 'Created successfully' } 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 }> => { export const updateRecord = async (pagetype: string, name: string, data: Record<string, any>): Promise<{ success: boolean; data?: any; message?: string }> => {
try { try {
const response = await axios.put( const response = await axios.put(
`/api/data/${pagetype}/${name}`, `/api/data/${pagetype}/${name}`, data)
data,
{
headers: get_session_api_headers(),
withCredentials: true
}
)
const message = response.data?.message const message = response.data?.message
return { success: true, data: message || response.data, message: 'Updated successfully' } 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 }> => { export const getRecord = async (pagetype: string, name: string): Promise<{ success: boolean; data?: any; message?: string }> => {
try { try {
const response = await axios.get( const response = await axios.get(
`/api/data/${pagetype}/${name}`, `/api/data/${pagetype}/${name}`)
{
headers: get_session_api_headers(),
withCredentials: true
}
)
return { success: true, data: response.data.data } return { success: true, data: response.data.data }
} catch (error: any) { } catch (error: any) {
return { success: false, message: error.response?.data?.message || error.message || '获取失败' } 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 attached_to_name: name
}), }),
fields: JSON.stringify(['name', 'file_name', 'file_url', 'is_private']) fields: JSON.stringify(['name', 'file_name', 'file_url', 'is_private'])
}, }
headers: get_session_api_headers(),
withCredentials: true
} }
) )
return { success: true, data: response.data.data || [] } return { success: true, data: response.data.data || [] }
@ -133,10 +111,8 @@ export const uploadAttachment = async (
formData, formData,
{ {
headers: { headers: {
...get_session_api_headers(),
'Content-Type': 'multipart/form-data' '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 }> => { export const deleteAttachment = async (attachmentName: string): Promise<{ success: boolean; message?: string }> => {
try { try {
await axios.delete( await axios.delete(
`/api/data/File/${attachmentName}`, `/api/data/File/${attachmentName}`)
{
headers: get_session_api_headers(),
withCredentials: true
}
)
return { success: true, message: '附件删除成功' } return { success: true, message: '附件删除成功' }
} catch (error: any) { } catch (error: any) {
return { success: false, message: error.response?.data?.message || error.message || '删除附件失败' } 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: { params: {
pagetype: pagetype 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 }> => { export const getLocalJobCount = async (): Promise<{ success: boolean; count?: number; message?: string }> => {
try { try {
const response = await axios.get( const response = await axios.get(
`/jingrow/local-job-count`, `/jingrow/local-job-count`)
{
headers: get_session_api_headers(),
withCredentials: true
}
)
const count = response.data?.count || 0 const count = response.data?.count || 0
return { return {
@ -234,9 +198,7 @@ export const getRecords = async (pagetype: string, filters: any[] = [], fields:
order_by: orderBy, order_by: orderBy,
limit_start: limitStart, limit_start: limitStart,
limit_page_length: limitPageLength limit_page_length: limitPageLength
}, }
headers: get_session_api_headers(),
withCredentials: true
} }
) )
@ -272,8 +234,6 @@ export const downloadImageToLocal = async (
filename: filename filename: filename
}, },
{ {
headers: get_session_api_headers(),
withCredentials: true,
timeout: 30000 timeout: 30000
} }
) )
@ -325,10 +285,8 @@ export const uploadFileToJingrow = async (
formData, formData,
{ {
headers: { headers: {
...get_session_api_headers(),
'Content-Type': 'multipart/form-data' 'Content-Type': 'multipart/form-data'
}, },
withCredentials: true,
timeout: 30000 timeout: 30000
} }
) )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -130,7 +130,6 @@ import {
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
import axios from 'axios' import axios from 'axios'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { get_session_api_headers } from '@/shared/api/auth'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
const fileList = ref<UploadFileInfo[]>([]) const fileList = ref<UploadFileInfo[]>([])
@ -243,7 +242,6 @@ const startUpload = async () => {
installMessage.value = t('Uploading file...') installMessage.value = t('Uploading file...')
const response = await axios.post(apiEndpoint, formData, { const response = await axios.post(apiEndpoint, formData, {
headers: { headers: {
...get_session_api_headers(),
'Content-Type': 'multipart/form-data' 'Content-Type': 'multipart/form-data'
}, },
onUploadProgress: (progressEvent) => { onUploadProgress: (progressEvent) => {
@ -301,10 +299,7 @@ const loadLocalApps = async () => {
loadingLocalApps.value = true loadingLocalApps.value = true
try { try {
const base = (import.meta as any).env.VITE_LOCAL_API_URL || '' const base = (import.meta as any).env.VITE_LOCAL_API_URL || ''
const response = await axios.get(`${base}/jingrow/local-apps`, { const response = await axios.get(`${base}/jingrow/local-apps`)
headers: get_session_api_headers(),
withCredentials: true
})
if (response.data.success) { if (response.data.success) {
localApps.value = response.data.data.apps localApps.value = response.data.data.apps
@ -321,10 +316,7 @@ const loadLocalApps = async () => {
const installLocalApp = async (appName: string) => { const installLocalApp = async (appName: string) => {
try { try {
const base = (import.meta as any).env.VITE_LOCAL_API_URL || '' const base = (import.meta as any).env.VITE_LOCAL_API_URL || ''
const response = await axios.post(`${base}/jingrow/install-local/${appName}`, {}, { const response = await axios.post(`${base}/jingrow/install-local/${appName}`)
headers: get_session_api_headers(),
withCredentials: true
})
if (response.data.success) { if (response.data.success) {
message.success(t('App \'{0}\' installed successfully').replace('{0}', appName)) 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 { Icon } from '@iconify/vue'
import axios from 'axios' import axios from 'axios'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
import InstallProgressModal from './InstallProgressModal.vue' import InstallProgressModal from './InstallProgressModal.vue'
const message = useMessage() const message = useMessage()
@ -303,7 +302,6 @@ async function performInstall(app: any) {
url: app.file_url url: app.file_url
}), { }), {
headers: { headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded' '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, { response = await axios.post('/jingrow/install-from-git', params, {
headers: { headers: {
...get_session_api_headers(),
'Content-Type': 'application/x-www-form-urlencoded' '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 { NCard, NForm, NFormItem, NSelect, NSwitch, NButton, NSpace, NCheckbox, NCheckboxGroup, useMessage, type FormInst, type FormRules } from 'naive-ui'
import axios from 'axios' import axios from 'axios'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
import { get_session_api_headers } from '@/shared/api/auth'
const message = useMessage() const message = useMessage()
@ -150,7 +149,7 @@ async function onDropdownShow(shown: boolean) {
if (!shown || pagetypeOptions.value.length) return if (!shown || pagetypeOptions.value.length) return
loading.value = true loading.value = true
try { 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 || [] const list = res.data?.data || []
pagetypeOptions.value = list.map((x: any) => ({ label: x.name, value: x.name })) pagetypeOptions.value = list.map((x: any) => ({ label: x.name, value: x.name }))
} catch (e: any) { } catch (e: any) {
@ -190,9 +189,7 @@ async function onPagetypeChange() {
if (!form.value.pagetype) return if (!form.value.pagetype) return
try { try {
const res = await axios.get(`/jingrow/get-module-app`, { const res = await axios.get(`/jingrow/get-module-app`, {
params: { pagetype: form.value.pagetype }, params: { pagetype: form.value.pagetype }
headers: get_session_api_headers(),
withCredentials: true
}) })
const msg = res.data?.message || {} const msg = res.data?.message || {}
if (msg?.success) { if (msg?.success) {
@ -217,7 +214,7 @@ async function handleSubmit() {
create_backend: form.value.createBackend, create_backend: form.value.createBackend,
frontend_options: form.value.frontendOptions || [], frontend_options: form.value.frontendOptions || [],
field_type_names: form.value.fieldTypeNames || [] field_type_names: form.value.fieldTypeNames || []
}, { headers: get_session_api_headers(), withCredentials: true }) }, {})
result.value = res.data result.value = res.data
if (res.data?.success) { if (res.data?.success) {
const { frontend_exists, backend_exists } = res.data const { frontend_exists, backend_exists } = res.data

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -132,7 +132,6 @@ import { t } from '@/shared/i18n'
import SchemaEditorModal from '@/core/components/SchemaEditorModal.vue' import SchemaEditorModal from '@/core/components/SchemaEditorModal.vue'
import PublishProgressModal, { type Step } from './PublishProgressModal.vue' import PublishProgressModal, { type Step } from './PublishProgressModal.vue'
import axios from 'axios' import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
import { packageNode, publishNodeToMarketplace } from '@/shared/api/nodes' import { packageNode, publishNodeToMarketplace } from '@/shared/api/nodes'
import { uploadFileToJingrow } from '@/shared/api/common' import { uploadFileToJingrow } from '@/shared/api/common'
@ -208,15 +207,9 @@ async function handleSchemaSave(schemaData: any) {
try { try {
// Schema // Schema
const response = await axios.put( const response = await axios.put(
`/api/data/${encodeURIComponent(props.entity)}/${encodeURIComponent(nodeName.value)}`, `/api/data/${encodeURIComponent(props.entity)}/${encodeURIComponent(nodeName.value)}`, {
{
node_schema: schemaData node_schema: schemaData
}, })
{
headers: get_session_api_headers(),
withCredentials: true
}
)
if (response.data?.success !== false) { 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 { NButton, NSpace, NIcon, NModal, NCard, useDialog, useMessage } from 'naive-ui'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
import axios from 'axios' import axios from 'axios'
import { get_session_api_headers } from '@/shared/api/auth'
const props = defineProps<{ const props = defineProps<{
context: { context: {
@ -111,9 +110,7 @@ const uninstallPackage = async (packageName: string) => {
uninstalling.value = true uninstalling.value = true
// API // API
const response = await axios.post(`/jingrow/uninstall-extension/${packageName}`, {}, { const response = await axios.post(`/jingrow/uninstall-extension/${packageName}`, {})
headers: get_session_api_headers()
})
if (response.data.success) { if (response.data.success) {
message.success(props.context.t("Package '{0}' uninstalled successfully").replace('{0}', packageName)) 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', { const response = await axios.post('/jingrow/get-package-dependencies', {
package_name: packageName package_name: packageName
}, {
headers: get_session_api_headers()
}) })
if (response.data.message.status === 'success') { if (response.data.message.status === 'success') {

View File

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

View File

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