mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-18 03:38:05 +08:00
refactor: Migrate to API v2
- Added auto schema migration - Refactored /api/subs, /api/collections, /api/artifacts. Now these APIs will return array instead of object. This enables sorting items in the future.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { SETTINGS_KEY } from './constants';
|
||||
import { SETTINGS_KEY } from '@/constants';
|
||||
import { success } from './response';
|
||||
import $ from '@/core/app';
|
||||
|
||||
export default function register($app) {
|
||||
@@ -8,20 +9,15 @@ export default function register($app) {
|
||||
|
||||
function getSettings(req, res) {
|
||||
const settings = $.read(SETTINGS_KEY);
|
||||
res.json(settings);
|
||||
success(res, settings);
|
||||
}
|
||||
|
||||
function updateSettings(req, res) {
|
||||
const data = req.body;
|
||||
const settings = $.read(SETTINGS_KEY);
|
||||
$.write(
|
||||
{
|
||||
...settings,
|
||||
...data,
|
||||
},
|
||||
SETTINGS_KEY,
|
||||
);
|
||||
res.json({
|
||||
status: 'success',
|
||||
});
|
||||
const newSettings = {
|
||||
...settings,
|
||||
...req.body,
|
||||
};
|
||||
$.write(newSettings, SETTINGS_KEY);
|
||||
success(res, newSettings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user