chore: update system setting name convention (#1448)

This commit is contained in:
boojack
2023-04-03 09:36:34 +08:00
committed by GitHub
parent 8a33290722
commit 4f2adfef7b
10 changed files with 135 additions and 105 deletions

View File

@@ -29,7 +29,7 @@ const StorageSection = () => {
const handleActiveStorageServiceChanged = async (storageId: StorageId) => {
await api.upsertSystemSetting({
name: "storageServiceId",
name: "storage-service-id",
value: JSON.stringify(storageId),
});
await globalStore.fetchSystemStatus();

View File

@@ -57,7 +57,7 @@ const SystemSection = () => {
useEffect(() => {
api.getSystemSetting().then(({ data: { data: systemSettings } }) => {
const openAIConfigSetting = systemSettings.find((setting) => setting.name === "openAIConfig");
const openAIConfigSetting = systemSettings.find((setting) => setting.name === "openai-config");
if (openAIConfigSetting) {
setOpenAIConfig(JSON.parse(openAIConfigSetting.value));
}
@@ -70,7 +70,7 @@ const SystemSection = () => {
allowSignUp: value,
});
await api.upsertSystemSetting({
name: "allowSignUp",
name: "allow-signup",
value: JSON.stringify(value),
});
};
@@ -100,7 +100,7 @@ const SystemSection = () => {
const handleSaveOpenAIConfig = async () => {
try {
await api.upsertSystemSetting({
name: "openAIConfig",
name: "openai-config",
value: JSON.stringify(openAIConfig),
});
} catch (error) {
@@ -127,7 +127,7 @@ const SystemSection = () => {
const handleSaveAdditionalStyle = async () => {
try {
await api.upsertSystemSetting({
name: "additionalStyle",
name: "additional-style",
value: JSON.stringify(state.additionalStyle),
});
} catch (error) {
@@ -147,7 +147,7 @@ const SystemSection = () => {
const handleSaveAdditionalScript = async () => {
try {
await api.upsertSystemSetting({
name: "additionalScript",
name: "additional-script",
value: JSON.stringify(state.additionalScript),
});
} catch (error) {
@@ -164,7 +164,7 @@ const SystemSection = () => {
});
globalStore.setSystemStatus({ disablePublicMemos: value });
await api.upsertSystemSetting({
name: "disablePublicMemos",
name: "disable-public-memos",
value: JSON.stringify(value),
});
};

View File

@@ -83,7 +83,7 @@ const UpdateCustomizedProfileDialog: React.FC<Props> = ({ destroy }: Props) => {
try {
await api.upsertSystemSetting({
name: "customizedProfile",
name: "customized-profile",
value: JSON.stringify(state),
});
await globalStore.fetchSystemStatus();

View File

@@ -23,7 +23,7 @@ const UpdateLocalStorageDialog: React.FC<Props> = (props: Props) => {
const handleConfirmBtnClick = async () => {
try {
await api.upsertSystemSetting({
name: "localStoragePath",
name: "local-storage-path",
value: JSON.stringify(path),
});
await globalStore.fetchSystemStatus();