Commit bdd28247 authored by TJHeeringa's avatar TJHeeringa

Removed deprecated endpoints

parent 234a7142
......@@ -73,6 +73,13 @@ export class Helper {
this.api_call(url, method, object, json_or_form_data, on_succes, on_failure, !external);
}
static api_callv3({url, method, object = undefined, json_or_form_data = "json", on_succes = undefined, on_failure = undefined, external = false}={}) {
if (!external) {
url = process.env.REACT_APP_API_URL + url;
}
this.api_call(url, method, object, json_or_form_data, on_succes, on_failure, !external);
}
static authenticate(cbCorrect, cbIncorrect, username, password) {
console.log("login");
Helper.api_call(
......
......@@ -129,7 +129,11 @@ class DataField extends Component {
}
postDataField = (data_field) => {
return Helper.api_call(process.env.REACT_APP_API_URL + "/association_data_fields", "POST", data_field, "json",
return Helper.api_call(
process.env.REACT_APP_API_URL + "/association_data_fields",
"POST",
data_field,
"json",
() => {
this.props.onAdd();
this.context.handleAlertHandler("green", "Save successful");
......@@ -345,7 +349,11 @@ export class AssociationDataFields extends Component {
}
getAssociationSpecificDataFields = () => {
return Helper.api_call(this.props.association.url + "/data_fields?ordering=name", "GET", null,"json",
return Helper.api_call(
process.env.REACT_APP_API_URL + "/data_fields?ordering=name&association__slug=" + this.props.association.slug,
"GET",
null,
"json",
(specific_data_fields)=> {this.setState({specific_data_fields: specific_data_fields.results});},
);
}
......
......@@ -363,7 +363,7 @@ export const AssociationMembertypes = (props) => {
const getAssociationMembertypes = () => {
return Helper.api_callv2({
url: props.association.url + "/membertypes?ordering=name",
url: process.env.REACT_APP_API_URL + "/membertypes?ordering=name&association__slug=" + props.association.slug,
method: "GET",
on_succes: (response)=>{setMembertypes(response.results);},
on_failure: ()=>{
......
......@@ -13,6 +13,7 @@ import React, {useEffect, useState} from "react";
import { Col,Row } from "reactstrap";
import { useGet } from "restful-react";
import { v4 as uuidv4 } from "uuid";
import Block from "../../Components/PageLayout/Content/Block";
......@@ -62,18 +63,18 @@ const Matchings = (props) => {
}, [classes]); // function is called whenever second attr changes; we don't want it to call aside from mounting so we use constant attr
let { data: members, loading: loadingMembers } = useGet({
path: props.association.url + "/members/current",
queryParams: {limit: 10000},
path: process.env.REACT_APP_API_URL + "/memberships",
queryParams: {limit: 10000, current: true, association__slug: props.association.slug},
resolve: data => data && data.results
});
let { data: data_fields, loading: loadingDataFields } = useGet({
path: props.association.url + "/data_fields",
queryParams: {limit: 10000},
path: process.env.REACT_APP_API_URL + "/association_data_fields",
queryParams: {limit: 10000, association__slug: props.association.slug},
resolve: data => data && data.results
});
let { data: membertypes, loading: loadingMembertypes } = useGet({
path: props.association.url + "/membertypes",
queryParams: {limit: 100},
path: process.env.REACT_APP_API_URL + "/membertypes",
queryParams: {limit: 100, association__slug: props.association.slug},
resolve: data => data && data.results
});
console.log(loadingMembers, loadingDataFields, loadingMembertypes);
......
......@@ -75,7 +75,8 @@ class GroupMemberManagement extends Component {
<Col>
<Row>
<Col>
<Get path={"/associations/" + association.slug + "/"+(group.board_group ? "boards" : "committees")+"/" + group.slug}
<Get
path={"/groups/" + group.slug}
key={this.state.key}
>
{ (data, { loading, error }) =>
......@@ -107,8 +108,8 @@ class GroupMemberManagement extends Component {
</Row>
<Row>
<Col>
<Get path={"/associations/" + association.slug + "/members/current"}
queryParams={{limit: 10000}}
<Get path={"/memberships"}
queryParams={{limit: 10000, association__slug: association.slug, current: true}}
>
{ (data, {loading, error}) =>
loading ? (
......
......@@ -17,18 +17,18 @@ export const GroupMemberManagementAssociationMemberList = (props) => {
const {group, association, onAdd} = props;
let { data: members, loading: loadingMembers } = useGet({
path: props.association.url + "/members/current",
queryParams: {limit: 10000},
path: process.env.REACT_APP_API_URL + "/memberships",
queryParams: {limit: 10000, current: true, association__slug: association.slug},
resolve: data => data && data.results
});
let { data: data_fields, loading: loadingDataFields } = useGet({
path: props.association.url + "/data_fields",
queryParams: {limit: 10000},
path: process.env.REACT_APP_API_URL + "/association_data_fields",
queryParams: {limit: 10000, association__slug: association.slug},
resolve: data => data && data.results
});
let { data: membertypes, loading: loadingMembertypes } = useGet({
path: props.association.url + "/membertypes",
queryParams: {limit: 100},
path: process.env.REACT_APP_API_URL + "/membertypes",
queryParams: {limit: 100, association__slug: association.slug},
resolve: data => data && data.results
});
console.log(loadingMembers, loadingDataFields, loadingMembertypes);
......
......@@ -26,7 +26,7 @@ class MembersCurrent extends Component {
componentDidMount() {
Helper.api_call(
this.props.association.url + "/data_fields?limit=1000",
process.env.REACT_APP_API_URL + "/association_data_fields?limit=1000&association__slug=" + this.props.association.slug,
"GET",
undefined,
"json",
......@@ -35,7 +35,7 @@ class MembersCurrent extends Component {
this.setState({data_fields: data_fields});
});
Helper.api_call(
this.props.association.url + "/membertypes?limit=1000",
process.env.REACT_APP_API_URL + "/membertypes?limit=1000&association__slug=" + this.props.association.slug,
"GET",
undefined,
"json",
......@@ -45,7 +45,7 @@ class MembersCurrent extends Component {
});
Helper.api_call(
this.props.association.url + "/members/current?limit=10000",
process.env.REACT_APP_API_URL + "/memberships?limit=1000&current=true&association__slug=" + this.props.association.slug,
"GET",
undefined,
"json",
......
......@@ -26,8 +26,9 @@ class MembersDisputed extends Component {
render() {
const { show_csv, association } = this.props;
return (
<Get path={"/associations/"+ association.slug +"/members/disputed"}
queryParams={{limit: 10000}}
<Get
path={"/memberships"}
queryParams={{limit: 10000, association__slug: association.slug, status: "Disputed"}}
>
{ (data, {loading, error}) =>
loading ? (
......
......@@ -24,7 +24,7 @@ class MembersIncoming extends Component {
refreshPendingMemberships = () => {
return Helper.api_call(
this.props.association.url + "/members/pending?limit=5000",
process.env.REACT_APP_API_URL + "/memberships?status=pending?limit=5000&association__slug=" + this.props.association.slug,
"GET",
undefined,
"json",
......
......@@ -28,8 +28,13 @@ class MembersLeaving extends Component {
const { show_csv } = this.props;
return (
<Get path={"/associations/"+ association.slug +"/members/leaving"}
queryParams={{limit: 10000}}
<Get
path={"/memberships"}
queryParams={{
limit: 10000,
association__slug: association.slug,
current: true,
date_left__isnull: false}}
>
{ (data, {loading, error}) =>
loading ? (
......
......@@ -30,13 +30,13 @@ const MembershipRequest = (props) => {
});
let { data: dataFields, loading: loadingDataFields } = useGet({
path: "/associations/" + association.slug + "/data_fields",
queryParams: {limit: 10000},
path: "/association_data_fields",
queryParams: {limit: 10000, association__slug: association.slug},
resolve: data => data && data.results
});
let { data: membertypes, loading: loadingMembertypes } = useGet({
path: "/associations/" + association.slug + "/membertypes",
queryParams: {limit: 10000},
path: "/membertypes",
queryParams: {limit: 10000, association__slug: association.slug},
resolve: data => data && data.results
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment