mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-11-18 04:33:22 +00:00
feat: get statuses / priorities from their respective tables
- adds schema.sql - format entire codebase
This commit is contained in:
@@ -9,28 +9,27 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import GeneralSettingForm from './GeneralSettingForm.vue'
|
||||
import PageHeader from '../common/PageHeader.vue'
|
||||
import api from '@/api';
|
||||
import api from '@/api'
|
||||
|
||||
const initialValues = ref({})
|
||||
|
||||
onMounted(async () => {
|
||||
const response = await api.getSettings('general');
|
||||
const data = response.data.data;
|
||||
const response = await api.getSettings('general')
|
||||
const data = response.data.data
|
||||
|
||||
initialValues.value = Object.keys(data).reduce((acc, key) => {
|
||||
// Remove 'app.' prefix
|
||||
const newKey = key.replace(/^app\./, '');
|
||||
acc[newKey] = data[key];
|
||||
return acc;
|
||||
}, {});
|
||||
});
|
||||
|
||||
const newKey = key.replace(/^app\./, '')
|
||||
acc[newKey] = data[key]
|
||||
return acc
|
||||
}, {})
|
||||
})
|
||||
|
||||
const submitForm = (values) => {
|
||||
// Prepend keys with `app.`
|
||||
const updatedValues = Object.fromEntries(
|
||||
Object.entries(values).map(([key, value]) => [`app.${key}`, value])
|
||||
);
|
||||
api.updateSettings('general', updatedValues);
|
||||
)
|
||||
api.updateSettings('general', updatedValues)
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user