MCPcopy Create free account
hub / github.com/bytebase/bytebase / persist

Function persist

frontend/src/react/stores/workspaceApprovalSetting.ts:46–61  ·  view source on GitHub ↗
(config: LocalApprovalConfig)

Source from the content-addressed store, hash-verified

44export 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) => {

Callers 1

applyAndPersistFunction · 0.85

Calls 1

Tested by

no test coverage detected