Skip to content

Commit 15ebf1d

Browse files
KhoaNguyen706maernest04
authored andcommitted
Implement event registration logic for SCEvents (#2073)
1 parent edafd59 commit 15ebf1d

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

src/APIFunctions/SCEvents.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,29 @@ export async function createSCEvent(eventBody) {
8383
}
8484
return status;
8585
}
86+
87+
export async function getEventByID(id) {
88+
let status = new ApiResponse();
89+
90+
try {
91+
const url = new URL(`/events/${id}`, SCEVENTS_API_URL);
92+
const res = await fetch(url.href, {
93+
method: 'GET',
94+
headers: {
95+
'Content-Type': 'application/json',
96+
},
97+
});
98+
99+
if (res.ok) {
100+
const result = await res.json();
101+
status.responseData = result;
102+
} else {
103+
status.error = true;
104+
}
105+
} catch (err) {
106+
status.error = true;
107+
status.responseData = err;
108+
}
109+
110+
return status;
111+
}

0 commit comments

Comments
 (0)