Admin event select signup form
This commit is contained in:
+25
-9
@@ -9,6 +9,20 @@ export interface Signup {
|
||||
list_name: string;
|
||||
}
|
||||
|
||||
export async function getSignup(id: number): Promise<Signup> {
|
||||
try {
|
||||
const resp = await axios.get(`${url}${id}`, {
|
||||
headers: {
|
||||
"Authorization": getAuthHeader()
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export async function createSignup(data: Signup): Promise<Signup> {
|
||||
try {
|
||||
const resp = await axios.post(url, data);
|
||||
@@ -19,12 +33,14 @@ export async function createSignup(data: Signup): Promise<Signup> {
|
||||
}
|
||||
}
|
||||
|
||||
// export async function updateSignup(data: Signup): Promise<Signup> {
|
||||
// try {
|
||||
// const resp = await axios.post(url, data);
|
||||
// return resp.data;
|
||||
// } catch (err) {
|
||||
// console.error(err);
|
||||
// throw err;
|
||||
// }
|
||||
// }
|
||||
export async function updateSignup(data: Signup): Promise<Signup> {
|
||||
try {
|
||||
const { id } = data;
|
||||
if (!id) throw new Error("SignupId required!");
|
||||
const resp = await axios.put(`${url}${id}`, data);
|
||||
return resp.data;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user