Add API route for training

This commit is contained in:
2020-01-16 06:17:33 +00:00
parent 801d35aa88
commit 57407be11e
6 changed files with 72 additions and 19 deletions

View File

@@ -116,7 +116,7 @@ export function InstructorClassDetail(props) {
};
export function InstructorClassList(props) {
const { course, setCourse, token, user } = props;
const { course, setCourse, token } = props;
const [open, setOpen] = useState(false);
const [input, setInput] = useState({});
const [error, setError] = useState(false);
@@ -126,7 +126,7 @@ export function InstructorClassList(props) {
const handleSubmit = (e) => {
setLoading(true);
setSuccess(false);
const data = { ...input, instructor: user.id, course: course.id };
const data = { ...input, course: course.id };
requester('/sessions/', 'POST', token, data)
.then(res => {
setSuccess(res.id);

View File

@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Table } from 'semantic-ui-react';
export const isAdmin = (user) => user.is_staff || user.member.is_director || user.member.is_staff;
export const isInstructor = (user) => isAdmin(user) || user.member.is_staff;
export const isInstructor = (user) => isAdmin(user) || user.member.is_instructor;
export const siteUrl = window.location.protocol + '//' + window.location.hostname;
export const apiUrl = window.location.protocol + '//api.' + window.location.hostname;