This commit is contained in:
parent
423254fc4b
commit
3225e84cff
|
|
@ -1,5 +1,6 @@
|
|||
import Request from "lib/utils/requests";
|
||||
import { translateApi, categoryApi, uploadApi } from '../common';
|
||||
import { REVALIDATE_SECRET } from '../../data/const';
|
||||
|
||||
export default {
|
||||
getDataList(params: any) {
|
||||
|
|
@ -39,5 +40,12 @@ export default {
|
|||
getCategoryList: categoryApi.getDataList,
|
||||
...translateApi,
|
||||
...uploadApi,
|
||||
revalidateCache(id: string | number) {
|
||||
fetch('/revalidate', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ id, secret: REVALIDATE_SECRET }),
|
||||
}).catch(() => {})
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ export const LOCALES = [
|
|||
},
|
||||
];
|
||||
|
||||
// Next.js 缓存刷新密钥
|
||||
export const REVALIDATE_SECRET = 'a6fa461b512dc9e8ece9a9fc2ed59debe50ee948fd430aaf688fbb060c7ec508'
|
||||
|
||||
// 分类
|
||||
export const categoryTypes = [
|
||||
{ key: 'process', name: '历程', path: '/history' },
|
||||
|
|
|
|||
|
|
@ -8,5 +8,10 @@ export default {
|
|||
target: isDev ? "http://10.3.0.7:9999/" : 'http://yintai.batiao8.com/',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/companyHome/, '')
|
||||
},
|
||||
'/revalidate': {
|
||||
target: 'https://www.china-yintai.com',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/revalidate/, '/api/revalidate')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ const data: TableData = {
|
|||
[self.bean.processTypes] = results.map(
|
||||
(res) => toOptions(res?.data?.items ?? [])
|
||||
)
|
||||
console.log('processTypes', self.bean.processTypes)
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ const data: TableData = {
|
|||
data[langKey][fieldKey] = langData[fieldKey];
|
||||
})
|
||||
})
|
||||
console.log('data', data)
|
||||
return data
|
||||
}}
|
||||
/>
|
||||
|
|
@ -69,7 +68,6 @@ const data: TableData = {
|
|||
async (self: any) => {
|
||||
if (self.bean) {
|
||||
self.bean.id = null;
|
||||
console.log('self.bean.jobTypes', self.bean.jobTypes)
|
||||
self.bean.form = [
|
||||
{
|
||||
name: '职业类别',
|
||||
|
|
|
|||
|
|
@ -46,8 +46,11 @@ const data: TableData = {
|
|||
|
||||
if (data.id) {
|
||||
await self.api?.updateData(params)
|
||||
self.api?.revalidateCache(data.id)
|
||||
} else {
|
||||
await self.api?.addData(params)
|
||||
const res = await self.api?.addData(params)
|
||||
const newId = res?.data?.id
|
||||
if (newId) self.api?.revalidateCache(newId)
|
||||
}
|
||||
self.bean.showEditorDialog = false;
|
||||
self.bean.id = null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue