mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-14 01:43:44 +08:00
fix: Cannot read properties of undefined (reading 'map') (close #148)
This commit is contained in:
@@ -322,6 +322,9 @@ const ChannelsTable = () => {
|
||||
const res = await API.get(
|
||||
`/api/channel/?p=${startIdx}&page_size=${pageSize}&id_sort=${idSort}`,
|
||||
);
|
||||
if (res === undefined) {
|
||||
return;
|
||||
}
|
||||
const { success, message, data } = res.data;
|
||||
if (success) {
|
||||
if (startIdx === 0) {
|
||||
@@ -608,6 +611,9 @@ const ChannelsTable = () => {
|
||||
let res = await API.get(`/api/group/`);
|
||||
// add 'all' option
|
||||
// res.data.data.unshift('all');
|
||||
if (res === undefined) {
|
||||
return;
|
||||
}
|
||||
setGroupOptions(
|
||||
res.data.data.map((group) => ({
|
||||
label: group,
|
||||
|
||||
@@ -156,6 +156,9 @@ const SiderBar = () => {
|
||||
|
||||
const loadStatus = async () => {
|
||||
const res = await API.get('/api/status');
|
||||
if (res === undefined) {
|
||||
return;
|
||||
}
|
||||
const { success, data } = res.data;
|
||||
if (success) {
|
||||
localStorage.setItem('status', JSON.stringify(data));
|
||||
|
||||
Reference in New Issue
Block a user