(config: LocalApprovalConfig)
| 44 | export const useWorkspaceApprovalSettingStore = |
| 45 | create<WorkspaceApprovalSettingState>()((set, get) => { |
| 46 | const persist = async (config: LocalApprovalConfig) => { |
| 47 | const approvalSetting = await buildWorkspaceApprovalSetting(config); |
| 48 | const response = await settingServiceClientConnect.updateSetting( |
| 49 | createProto(UpdateSettingRequestSchema, { |
| 50 | setting: createProto(SettingSchema, { |
| 51 | name: `${settingNamePrefix}${Setting_SettingName[Setting_SettingName.WORKSPACE_APPROVAL]}`, |
| 52 | value: createProto(SettingValueSchema, { |
| 53 | value: { case: "workspaceApproval", value: approvalSetting }, |
| 54 | }), |
| 55 | }), |
| 56 | allowMissing: true, |
| 57 | }) |
| 58 | ); |
| 59 | // Keep the app-store setting cache in sync (mirrors the Pinia bridge). |
| 60 | useAppStore.getState().setSettingByName(response); |
| 61 | }; |
| 62 | |
| 63 | // Optimistically apply `nextConfig`, persist it, and roll back on failure. |
| 64 | const applyAndPersist = async (nextConfig: LocalApprovalConfig) => { |
no test coverage detected