Updated authentication.
This commit is contained in:
+13
-13
@@ -27,7 +27,7 @@ export const doLogin = async (t: TestController) => {
|
||||
};
|
||||
|
||||
export async function generateToken(): Promise<string> {
|
||||
const tokenUrl = `${API_URL}/api-token-auth/`;
|
||||
const tokenUrl = `${API_URL}/token/`;
|
||||
|
||||
try {
|
||||
const resp = await axios.post(tokenUrl, {
|
||||
@@ -43,11 +43,11 @@ export async function generateToken(): Promise<string> {
|
||||
|
||||
const eventURL = `${API_URL}/events/`;
|
||||
|
||||
export async function createEvent(data, jwt: string) {
|
||||
export async function createEvent(data, jwt_access: string) {
|
||||
try {
|
||||
const resp = await axios.post(eventURL, data, {
|
||||
headers: {
|
||||
Authorization: `JWT ${jwt}`,
|
||||
Authorization: `Bearer ${jwt_access}`,
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
@@ -57,11 +57,11 @@ export async function createEvent(data, jwt: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteEvent(id: string, jwt: string) {
|
||||
export async function deleteEvent(id: string, jwt_access: string) {
|
||||
try {
|
||||
const resp = await axios.delete(`${eventURL}${id}/`, {
|
||||
headers: {
|
||||
Authorization: `JWT ${jwt}`,
|
||||
Authorization: `Bearer ${jwt_access}`,
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
@@ -73,11 +73,11 @@ export async function deleteEvent(id: string, jwt: string) {
|
||||
|
||||
const formURL = `${API_URL}/signupForm/`;
|
||||
|
||||
export async function createForm(data, jwt: string) {
|
||||
export async function createForm(data, jwt_access: string) {
|
||||
try {
|
||||
const resp = await axios.post(formURL, data, {
|
||||
headers: {
|
||||
Authorization: `JWT ${jwt}`,
|
||||
Authorization: `Bearer ${jwt_access}`,
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
@@ -87,11 +87,11 @@ export async function createForm(data, jwt: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteForm(id: string, jwt: string) {
|
||||
export async function deleteForm(id: string, jwt_access: string) {
|
||||
try {
|
||||
const resp = await axios.delete(`${formURL}${id}/`, {
|
||||
headers: {
|
||||
Authorization: `JWT ${jwt}`,
|
||||
Authorization: `Bearer ${jwt_access}`,
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
@@ -101,7 +101,7 @@ export async function deleteForm(id: string, jwt: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export const generateTestForm = async (jwt: string) => (
|
||||
export const generateTestForm = async (jwt_access: string) => (
|
||||
createForm({
|
||||
title_fi: "Testi Ilmo",
|
||||
title_en: "Test Signup",
|
||||
@@ -132,10 +132,10 @@ export const generateTestForm = async (jwt: string) => (
|
||||
},
|
||||
},
|
||||
},
|
||||
}, jwt)
|
||||
}, jwt_access)
|
||||
);
|
||||
|
||||
export const generateTestEvent = async (formIds = [], jwt: string) => (
|
||||
export const generateTestEvent = async (formIds = [], jwt_access: string) => (
|
||||
createEvent({
|
||||
tags: [1],
|
||||
visible: true,
|
||||
@@ -153,7 +153,7 @@ export const generateTestEvent = async (formIds = [], jwt: string) => (
|
||||
signupForm: formIds,
|
||||
signup_id: formIds,
|
||||
tag_id: [1],
|
||||
}, jwt)
|
||||
}, jwt_access)
|
||||
);
|
||||
|
||||
export const sleep = async (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
Reference in New Issue
Block a user