Skip to content

Commit

Permalink
Call /requests/membership instead of /requests in front end
Browse files Browse the repository at this point in the history
  • Loading branch information
gabeweng committed Jan 17, 2025
1 parent af98b45 commit d8a7c78
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion frontend/components/ClubPage/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const RequestMembershipButton = ({

// sanity check
const resp = await doApiRequest(
`/requests/${club.code}/?format=json`,
`/requests/membership/${club.code}/?format=json`,
)

if (resp.ok) {
Expand Down
8 changes: 4 additions & 4 deletions frontend/components/Settings/MembershipRequestsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const MembershipRequestsTab = (): ReactElement => {
const [requests, setRequests] = useState<MembershipRequest[] | null>(null)

const fetchTable = (): void => {
doApiRequest('/requests/?format=json')
doApiRequest('/requests/membership/?format=json')
.then((resp) => resp.json())
.then(setRequests)
}
Expand All @@ -29,9 +29,9 @@ const MembershipRequestsTab = (): ReactElement => {
}

const withdrawRequest = (code: string): void => {
doApiRequest(`/requests/${code}/?format=json`, { method: 'DELETE' }).then(
fetchTable,
)
doApiRequest(`/requests/membership/${code}/?format=json`, {
method: 'DELETE',
}).then(fetchTable)
}

return (
Expand Down
4 changes: 2 additions & 2 deletions frontend/pages/club/[club]/apply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ const ApplyPage = ({ club, applications }: Props): ReactElement => {
updateRequests={async (code: string) => {
logEvent('request', code)
if (updatedIsRequest) {
await doApiRequest(`/requests/${club.code}/?format=json`, {
await doApiRequest(`/requests/membership/${club.code}/?format=json`, {
method: 'DELETE',
})
} else {
await doApiRequest(`/requests/?format=json`, {
await doApiRequest(`/requests/membership/?format=json`, {
method: 'POST',
body: { club: code },
})
Expand Down
4 changes: 2 additions & 2 deletions frontend/pages/club/[club]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ const ClubPage = ({
const newClub = { ...club }
logEvent(!newClub.is_request ? 'request' : 'unrequest', code)
const req = !newClub.is_request
? doApiRequest('/requests/?format=json', {
? doApiRequest('/requests/membership/?format=json', {
method: 'POST',
body: {
club: code,
},
})
: doApiRequest(`/requests/${code}/?format=json`, {
: doApiRequest(`/requests/membership/${code}/?format=json`, {
method: 'DELETE',
})

Expand Down

0 comments on commit d8a7c78

Please sign in to comment.