mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-10 08:03:41 +08:00
fix: Cannot read properties of undefined (reading 'map') (close #148)
This commit is contained in:
@@ -188,6 +188,9 @@ const EditChannel = (props) => {
|
||||
const loadChannel = async () => {
|
||||
setLoading(true);
|
||||
let res = await API.get(`/api/channel/${channelId}`);
|
||||
if (res === undefined) {
|
||||
return;
|
||||
}
|
||||
const { success, message, data } = res.data;
|
||||
if (success) {
|
||||
if (data.models === '') {
|
||||
@@ -223,6 +226,9 @@ const EditChannel = (props) => {
|
||||
const fetchModels = async () => {
|
||||
try {
|
||||
let res = await API.get(`/api/channel/models`);
|
||||
if (res === undefined) {
|
||||
return;
|
||||
}
|
||||
let localModelOptions = res.data.data.map((model) => ({
|
||||
label: model.id,
|
||||
value: model.id,
|
||||
@@ -244,6 +250,9 @@ const EditChannel = (props) => {
|
||||
const fetchGroups = async () => {
|
||||
try {
|
||||
let res = await API.get(`/api/group/`);
|
||||
if (res === undefined) {
|
||||
return;
|
||||
}
|
||||
setGroupOptions(
|
||||
res.data.data.map((group) => ({
|
||||
label: group,
|
||||
|
||||
Reference in New Issue
Block a user