Skip to content

Commit

Permalink
Create club utility scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Bostonian02 committed Apr 17, 2024
1 parent 955fddb commit 32ff8a4
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
16 changes: 16 additions & 0 deletions frontend/src/utils/fetchClubs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import axios from 'axios';
const token = sessionStorage.getItem('token');
const url = import.meta.env.PROD
? ''
: 'http://localhost:3000/rsos/'

const fetchClubs = () => {
return axios.get(url, {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.data)
}

export default fetchClubs;
17 changes: 17 additions & 0 deletions frontend/src/utils/joinRSO.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import axios from 'axios';
const token = sessionStorage.getItem('token');

const joinRSO = (rsoID) => {
const url = import.meta.env.PROD
? ''
: `http://localhost:3000/rsos/${rsoID}/join`
return axios.post(url, {}, {
headers: {
'Content-Type': 'json',
'Authorization': `Bearer ${token}`
}
})
.then(response => response.data)
}

export default joinRSO;
17 changes: 17 additions & 0 deletions frontend/src/utils/leaveRSO.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import axios from 'axios';
const token = sessionStorage.getItem('token');

const leaveRSO = (rsoID) => {
const url = import.meta.env.PROD
? ''
: `http://localhost:3000/rsos/${rsoID}/leave`
return axios.post(url, {}, {
headers: {
'Content-Type': 'json',
'Authorization': `Bearer ${token}`
}
})
.then(response => response.data)
}

export default leaveRSO;

0 comments on commit 32ff8a4

Please sign in to comment.