Skip to content

Commit

Permalink
remove unuseful const creation
Browse files Browse the repository at this point in the history
  • Loading branch information
patriciareinoso committed Jul 31, 2024
1 parent 216f56a commit e350eef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 40 deletions.
12 changes: 4 additions & 8 deletions utils/callDeviceGroupApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ function isValidDeviceGroupName(name: string): boolean {

export const apiGetAllDeviceGroups = async () => {
try {
const response = await fetch(`/config/v1/device-group/`, {
return await fetch(`/config/v1/device-group/`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
return response
} catch (error) {
console.error(error);
throw error;
Expand All @@ -22,13 +21,12 @@ export const apiGetDeviceGroup = async (name: string) => {
throw new Error(`Error getting device group: Invalid name provided ${name}.`);
}
try {
const response = await fetch(`/config/v1/device-group/${name}`, {
return await fetch(`/config/v1/device-group/${name}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
return response
} catch (error) {
console.error(error);
throw error;
Expand All @@ -40,14 +38,13 @@ export const apiPostDeviceGroup = async (name: string, deviceGroupData: any) =>
throw new Error(`Error updating device group: Invalid name provided ${name}.`);
}
try {
const response = await fetch(`/config/v1/device-group/${name}`, {
return await fetch(`/config/v1/device-group/${name}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(deviceGroupData),
});
return response
} catch (error) {
console.error(error);
throw error;
Expand All @@ -59,13 +56,12 @@ export const apiDeleteDeviceGroup = async (name: string) => {
throw new Error(`Error deleting device group: Invalid name provided ${name}.`);
}
try {
const response = await fetch(`/config/v1/device-group/${name}`, {
return await fetch(`/config/v1/device-group/${name}`, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
});
return response
} catch (error) {
console.error(error);
throw error;
Expand Down
12 changes: 4 additions & 8 deletions utils/callNetworkSliceApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ function isValidNetworkSliceName(name: string): boolean {

export const apiGetAllNetworkSlices = async () => {
try {
const networkSlicesResponse = await fetch(`/config/v1/network-slice`, {
return await fetch(`/config/v1/network-slice`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
return networkSlicesResponse
} catch (error) {
console.error(error);
throw error;
Expand All @@ -22,13 +21,12 @@ export const apiGetNetworkSlice = async (name: string) => {
throw new Error(`Error getting network slice: Invalid name provided ${name}.`);
}
try {
const response = await fetch(`/config/v1/network-slice/${name}`, {
return await fetch(`/config/v1/network-slice/${name}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
return response
} catch (error) {
console.error(error);
throw error;
Expand All @@ -40,14 +38,13 @@ export const apiPostNetworkSlice = async (name: string, sliceData: any) => {
throw new Error(`Error updating network slice: Invalid name provided ${name}.`);
}
try {
const response = await fetch(`/config/v1/network-slice/${name}`, {
return await fetch(`/config/v1/network-slice/${name}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(sliceData),
});
return response
} catch (error) {
console.error(error);
throw error;
Expand All @@ -59,13 +56,12 @@ export const apiDeleteNetworkSlice = async (name: string) => {
throw new Error(`Error deleting network slice: Invalid name provided ${name}.`);
}
try {
const response = await fetch(`/config/v1/network-slice/${name}`, {
return await fetch(`/config/v1/network-slice/${name}`, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
});
return response
} catch (error) {
console.error(error);
throw error;
Expand Down
12 changes: 4 additions & 8 deletions utils/callSubscriberApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ function isValidSubscriberName(name: string): boolean {

export const apiGetAllSubscribers = async () => {
try {
var response = await fetch(`/api/subscriber`, {
return await fetch(`/api/subscriber`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
return response
} catch (error) {
console.error(error);
throw error;
Expand All @@ -22,13 +21,12 @@ export const apiGetSubscriber = async (imsi: string) => {
throw new Error(`Error getting subscriber: Invalid name provided ${imsi}.`);
}
try {
const response = await fetch(`/api/subscriber/imsi-${imsi}`, {
return await fetch(`/api/subscriber/imsi-${imsi}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
return response
} catch (error) {
console.error(error);
throw error;
Expand All @@ -40,14 +38,13 @@ export const apiPostSubscriber = async (imsi: string, subscriberData: any) => {
throw new Error(`Error updating subscriber: Invalid name provided ${imsi}.`);
}
try {
const response = await fetch(`/api/subscriber/imsi-${imsi}`, {
return await fetch(`/api/subscriber/imsi-${imsi}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(subscriberData),
});
return response
} catch (error) {
console.error(error);
throw error;
Expand All @@ -59,13 +56,12 @@ export const apiDeleteSubscriber = async (imsi: string) => {
throw new Error(`Error deleting subscriber: Invalid name provided ${imsi}.`);
}
try {
const response = await fetch(`/api/subscriber/imsi-${imsi}`, {
return await fetch(`/api/subscriber/imsi-${imsi}`, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
});
return response
} catch (error) {
console.error(error);
throw error;
Expand Down
16 changes: 0 additions & 16 deletions utils/getNetworkSlice.tsx

This file was deleted.

0 comments on commit e350eef

Please sign in to comment.