feat(settings): Add independent plugin to put loading system configuration in the lifecycle hook "app:created".

This commit is contained in:
Rafi
2023-04-18 10:29:09 +08:00
parent 9fe7943152
commit 76b865646c
8 changed files with 72 additions and 79 deletions

View File

@@ -44,25 +44,6 @@ export const genTitle = async (conversationId) => {
return null
}
const transformData = (list) => {
const result = {};
for (let i = 0; i < list.length; i++) {
const item = list[i];
result[item.name] = item.value;
}
return result;
}
export const fetchSystemSettings = async () => {
const { data, error } = await useAuthFetch('/api/chat/settings/', {
method: 'GET',
})
if (!error.value) {
const settings = useSettings()
settings.value = transformData(data.value)
}
}
export const fetchUser = async () => {
return useMyFetch('/api/account/user/')
}