Simple delete functionality to Signup admin
This commit is contained in:
+18
-4
@@ -8,7 +8,7 @@ export interface Signup {
|
||||
answer: string;
|
||||
}
|
||||
|
||||
export async function getSignup(id: number): Promise<Signup> {
|
||||
export const getSignup = async (id: number): Promise<Signup> => {
|
||||
try {
|
||||
const resp = await axios.get(`${url}${id}`, {
|
||||
headers: {
|
||||
@@ -22,7 +22,7 @@ export async function getSignup(id: number): Promise<Signup> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function createSignup(data: Signup): Promise<Signup> {
|
||||
export const createSignup = async (data: Signup): Promise<Signup> => {
|
||||
try {
|
||||
const resp = await axios.post(url, data);
|
||||
return resp.data;
|
||||
@@ -32,7 +32,7 @@ export async function createSignup(data: Signup): Promise<Signup> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateSignup(data: Signup, uuid: string): Promise<Signup> {
|
||||
export const updateSignup = async (data: Signup, uuid: string): Promise<Signup> => {
|
||||
try {
|
||||
const { id } = data;
|
||||
if (!id) throw new Error("SignupId required!");
|
||||
@@ -46,7 +46,7 @@ export async function updateSignup(data: Signup, uuid: string): Promise<Signup>
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSignupUUID(id: number, uuid: string): Promise<Signup> {
|
||||
export const getSignupUUID = async (id: number, uuid: string): Promise<Signup> => {
|
||||
try {
|
||||
const resp = await axios.get(`${url}${id}/edit/`, {
|
||||
params: {
|
||||
@@ -59,3 +59,17 @@ export async function getSignupUUID(id: number, uuid: string): Promise<Signup> {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export const deleteSignup = async (id: number): Promise<Signup> => {
|
||||
try {
|
||||
const resp = await axios.delete(`${url}${id}`, {
|
||||
headers: {
|
||||
"Authorization": getAuthHeader()
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user