-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b046f88
commit e806a82
Showing
17 changed files
with
241 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
// import type { UpsertSystemSettingBody } from '@cpn-console/shared' | ||
import type { UpsertSystemSettingsBody } from '@cpn-console/shared' | ||
import { upsertSystemSetting as upsertSystemSettingQuery } from './queries.js' | ||
|
||
import { config } from '@/utils/config.js' | ||
|
||
export function getSystemSettings(key?: keyof typeof config) { | ||
// getSystemSettingsQuery({ key }) | ||
import { getConfig } from '@/utils/config.js' | ||
|
||
export async function getSystemSettings(key?: keyof UpsertSystemSettingsBody) { | ||
const config = await getConfig() | ||
if (key) { | ||
return { [key]: config[key] } | ||
} else { | ||
return config | ||
} | ||
} | ||
|
||
// export const upsertSystemSetting = (newSystemSetting: UpsertSystemSettingBody) => upsertSystemSettingQuery(newSystemSetting) | ||
export async function upsertSystemSettings(newSystemSettings: UpsertSystemSettingsBody) { | ||
for (const [key, value] of Object.entries(newSystemSettings)) { | ||
await upsertSystemSettingQuery({ key, value }) | ||
} | ||
return getSystemSettings() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.