Add cleanup hooks for E2E tests
This commit is contained in:
@@ -3,6 +3,7 @@ import { getAuthHeader } from "@utils/auth";
|
||||
import { Tag } from "./Tag";
|
||||
import qs from "query-string";
|
||||
import { SignupForm } from "./SignupForm";
|
||||
|
||||
const url = `${process.env.API_URL}/events/`;
|
||||
|
||||
export interface Event {
|
||||
@@ -89,3 +90,17 @@ export async function updateEvent(data): Promise<Event> {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteEvent(id: number) {
|
||||
try {
|
||||
const resp = await axios.delete(`${url}${id}`, {
|
||||
headers: {
|
||||
"Authorization": getAuthHeader()
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export const getSignupUUID = async (id: number, uuid: string): Promise<Signup> =
|
||||
}
|
||||
}
|
||||
|
||||
export const deleteSignup = async (id: number): Promise<Signup> => {
|
||||
export const deleteSignup = async (id: number) => {
|
||||
try {
|
||||
const resp = await axios.delete(`${url}${id}`, {
|
||||
headers: {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import axios from "axios";
|
||||
import { getAuthHeader } from "@utils/auth";
|
||||
const url = `${process.env.API_URL}/signupForm/`;
|
||||
import { Question } from "@components/Widgets/SignupQuestionsWidget";
|
||||
import { Signup } from "./Signup";
|
||||
|
||||
const url = `${process.env.API_URL}/signupForm/`;
|
||||
|
||||
export interface SignupForm {
|
||||
id?: number;
|
||||
title_fi: string;
|
||||
@@ -79,6 +80,20 @@ export async function updateForm(data): Promise<SignupForm> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteForm(id: number) {
|
||||
try {
|
||||
const resp = await axios.delete(`${url}${id}`, {
|
||||
headers: {
|
||||
"Authorization": getAuthHeader()
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export const signupFormSendEmail = async (data, id): Promise<any> => {
|
||||
try {
|
||||
const resp = await axios.post(`${process.env.API_URL}/signupForm/${id}/sendemail/`, data, {
|
||||
|
||||
Reference in New Issue
Block a user