Merge branch 'main' into feat/default_workflows

This commit is contained in:
Millun Atluri 2023-12-21 10:35:02 +11:00 committed by GitHub
commit 9b4758f02f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 13 deletions

View File

@ -1119,7 +1119,10 @@
"deletedInvalidEdge": "已删除无效的边缘 {{source}} -> {{target}}", "deletedInvalidEdge": "已删除无效的边缘 {{source}} -> {{target}}",
"unknownInput": "未知输入:{{name}}", "unknownInput": "未知输入:{{name}}",
"prototypeDesc": "此调用是一个原型 (prototype)。它可能会在本项目更新期间发生破坏性更改,并且随时可能被删除。", "prototypeDesc": "此调用是一个原型 (prototype)。它可能会在本项目更新期间发生破坏性更改,并且随时可能被删除。",
"betaDesc": "此调用尚处于测试阶段。在稳定之前,它可能会在项目更新期间发生破坏性更改。本项目计划长期支持这种调用。" "betaDesc": "此调用尚处于测试阶段。在稳定之前,它可能会在项目更新期间发生破坏性更改。本项目计划长期支持这种调用。",
"newWorkflow": "新建工作流",
"newWorkflowDesc": "是否创建一个新的工作流?",
"newWorkflowDesc2": "当前工作流有未保存的更改。"
}, },
"controlnet": { "controlnet": {
"resize": "直接缩放", "resize": "直接缩放",
@ -1635,7 +1638,7 @@
"openWorkflow": "打开工作流", "openWorkflow": "打开工作流",
"clearWorkflowSearchFilter": "清除工作流检索过滤器", "clearWorkflowSearchFilter": "清除工作流检索过滤器",
"workflowLibrary": "工作流库", "workflowLibrary": "工作流库",
"downloadWorkflow": "下载工作流", "downloadWorkflow": "保存到文件",
"noRecentWorkflows": "无最近工作流", "noRecentWorkflows": "无最近工作流",
"workflowSaved": "已保存工作流", "workflowSaved": "已保存工作流",
"workflowIsOpen": "工作流已打开", "workflowIsOpen": "工作流已打开",
@ -1648,8 +1651,9 @@
"deleteWorkflow": "删除工作流", "deleteWorkflow": "删除工作流",
"workflows": "工作流", "workflows": "工作流",
"noDescription": "无描述", "noDescription": "无描述",
"uploadWorkflow": "上传工作流", "uploadWorkflow": "从文件中加载",
"userWorkflows": "我的工作流" "userWorkflows": "我的工作流",
"newWorkflowCreated": "已创建新的工作流"
}, },
"app": { "app": {
"storeNotInitialized": "商店尚未初始化" "storeNotInitialized": "商店尚未初始化"

View File

@ -34,6 +34,7 @@ import { actionSanitizer } from './middleware/devtools/actionSanitizer';
import { actionsDenylist } from './middleware/devtools/actionsDenylist'; import { actionsDenylist } from './middleware/devtools/actionsDenylist';
import { stateSanitizer } from './middleware/devtools/stateSanitizer'; import { stateSanitizer } from './middleware/devtools/stateSanitizer';
import { listenerMiddleware } from './middleware/listenerMiddleware'; import { listenerMiddleware } from './middleware/listenerMiddleware';
import { authToastMiddleware } from 'services/api/authToastMiddleware';
const allReducers = { const allReducers = {
canvas: canvasReducer, canvas: canvasReducer,
@ -96,6 +97,7 @@ export const createStore = (uniqueStoreKey?: string, persist = true) =>
}) })
.concat(api.middleware) .concat(api.middleware)
.concat(dynamicMiddlewares) .concat(dynamicMiddlewares)
.concat(authToastMiddleware)
.prepend(listenerMiddleware.middleware), .prepend(listenerMiddleware.middleware),
enhancers: (getDefaultEnhancers) => { enhancers: (getDefaultEnhancers) => {
const _enhancers = getDefaultEnhancers().concat(autoBatchEnhancer()); const _enhancers = getDefaultEnhancers().concat(autoBatchEnhancer());

View File

@ -5,14 +5,12 @@ import { t } from 'i18next';
import { z } from 'zod'; import { z } from 'zod';
const zRejectedForbiddenAction = z.object({ const zRejectedForbiddenAction = z.object({
action: z.object({
payload: z.object({ payload: z.object({
status: z.literal(403), status: z.literal(403),
data: z.object({ data: z.object({
detail: z.string(), detail: z.string(),
}), }),
}), }),
}),
}); });
export const authToastMiddleware: Middleware = export const authToastMiddleware: Middleware =
@ -22,8 +20,8 @@ export const authToastMiddleware: Middleware =
const parsed = zRejectedForbiddenAction.parse(action); const parsed = zRejectedForbiddenAction.parse(action);
const { dispatch } = api; const { dispatch } = api;
const customMessage = const customMessage =
parsed.action.payload.data.detail !== 'Forbidden' parsed.payload.data.detail !== 'Forbidden'
? parsed.action.payload.data.detail ? parsed.payload.data.detail
: undefined; : undefined;
dispatch( dispatch(
addToast({ addToast({
@ -32,7 +30,7 @@ export const authToastMiddleware: Middleware =
description: customMessage, description: customMessage,
}) })
); );
} catch { } catch (error) {
// no-op // no-op
} }
} }