feat: update API response structure to nest payloads under a single "data" key
This commit is contained in:
@@ -34,18 +34,20 @@ async function submit() {
|
||||
try {
|
||||
if (mode.value === 'login') {
|
||||
const res = await authApi.login(form.username.trim(), form.password);
|
||||
afterLogin(res.token, {
|
||||
userID: res.userID,
|
||||
username: res.username,
|
||||
level: res.level,
|
||||
registerDate: res.registerDate
|
||||
const d = res.data;
|
||||
afterLogin(d.token, {
|
||||
userID: d.userID,
|
||||
username: d.username,
|
||||
level: d.level,
|
||||
registerDate: d.registerDate
|
||||
});
|
||||
} else {
|
||||
const res = await authApi.register(form.username.trim(), form.password);
|
||||
afterLogin(res.token, {
|
||||
userID: res.userID,
|
||||
username: res.username,
|
||||
level: res.level
|
||||
const d = res.data;
|
||||
afterLogin(d.token, {
|
||||
userID: d.userID,
|
||||
username: d.username,
|
||||
level: d.level
|
||||
});
|
||||
toast.success('Admin created — welcome to Nukumizu');
|
||||
}
|
||||
|
||||
@@ -43,12 +43,13 @@ async function load() {
|
||||
serverApi.infoAll(),
|
||||
settingsApi.get('bot_node_config')
|
||||
]);
|
||||
const nodeConf = (nodes && nodes.config) || {};
|
||||
const statusData = (status && status.data) || {};
|
||||
const infoData = (info && info.data) || {};
|
||||
const nodeConf = (nodes && nodes.data && nodes.data.config) || {};
|
||||
const list = [];
|
||||
for (const key of Object.keys(status)) {
|
||||
if (key === 'success') continue;
|
||||
const s = status[key] || {};
|
||||
const infoEntry = info[key] || {};
|
||||
for (const key of Object.keys(statusData)) {
|
||||
const s = statusData[key] || {};
|
||||
const infoEntry = infoData[key] || {};
|
||||
const conf = nodeConf[key] || {};
|
||||
list.push({
|
||||
uuid: s.uuid || key,
|
||||
|
||||
@@ -168,7 +168,7 @@ function defaults(f) {
|
||||
async function load() {
|
||||
try {
|
||||
const res = await settingsApi.get('global');
|
||||
const cfg = (res && res.config) || {};
|
||||
const cfg = (res && res.data && res.data.config) || {};
|
||||
for (const s of sections) {
|
||||
const obj = {};
|
||||
for (const f of s.fields) {
|
||||
|
||||
@@ -50,7 +50,7 @@ const defaultOpts = () => ({
|
||||
async function load() {
|
||||
try {
|
||||
const res = await settingsApi.get('bot_user_config');
|
||||
const cfg = (res && res.config) || {};
|
||||
const cfg = (res && res.data && res.data.config) || {};
|
||||
const flat = [];
|
||||
for (const c of CHANNELS) {
|
||||
const chData = cfg[c.key] || {};
|
||||
|
||||
Reference in New Issue
Block a user