-
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
c04cc61
commit 1be0b07
Showing
40 changed files
with
559 additions
and
465 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,29 +1,26 @@ | ||
import { defineStore } from 'pinia' | ||
import type { | ||
SystemSettings, | ||
UpsertSystemSettingsBody, | ||
} from '@cpn-console/shared' | ||
import { defineStore } from 'pinia' | ||
import { apiClient, extractData } from '@/api/xhr-client.js' | ||
|
||
export const useSystemSettingsStore = defineStore('systemSettings', () => { | ||
const systemSettings = ref<SystemSettings>() | ||
const systemSettings = ref<Partial<SystemSettings>>() | ||
|
||
const listSystemSettings = async (key?: keyof SystemSettings) => { | ||
systemSettings.value = await apiClient.SystemSettings.listSystemSettings({ query: { key } }) | ||
.then(response => extractData(response, 200)) | ||
} | ||
|
||
// const upsertSystemSetting = async (newSystemSetting: UpsertSystemSettingBody) => { | ||
// const res = await apiClient.SystemSettings.upsertSystemSetting({ body: newSystemSetting }) | ||
// .then(response => extractData(response, 201)) | ||
// systemSettings.value = systemSettings.value | ||
// .toSpliced(systemSettings.value | ||
// .findIndex(systemSetting => systemSetting.key === res.key), 1, res) | ||
// return res | ||
// } | ||
const upsertSystemSettings = async (newSystemSetting: UpsertSystemSettingsBody) => { | ||
systemSettings.value = await apiClient.SystemSettings.upsertSystemSettings({ body: newSystemSetting }) | ||
.then(response => extractData(response, 201)) | ||
} | ||
|
||
return { | ||
systemSettings, | ||
listSystemSettings, | ||
// upsertSystemSetting, | ||
upsertSystemSettings, | ||
} | ||
}) |
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.