provide the auth token with limited requests
This commit is contained in:
parent
beb804e38c
commit
2eb4651aa4
|
@ -1,5 +1,8 @@
|
|||
export default {
|
||||
userId(state) {
|
||||
return state.userId;
|
||||
},
|
||||
token(state) {
|
||||
return state.token;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,8 +12,14 @@ export default {
|
|||
areas: data.areas
|
||||
};
|
||||
|
||||
const token = context.rootGetters.token;
|
||||
const axiosConfig = {
|
||||
params: { auth: token }
|
||||
};
|
||||
|
||||
try {
|
||||
await getAPI.put(`coaches/${userId}.json`, coachData);
|
||||
console.log(axiosConfig);
|
||||
await getAPI.put(`coaches/${userId}.json`, coachData, axiosConfig);
|
||||
context.commit('registerCoach', {
|
||||
...coachData,
|
||||
id: userId
|
||||
|
|
|
@ -21,9 +21,17 @@ export default {
|
|||
}
|
||||
},
|
||||
async fetchRequests(context) {
|
||||
const coachId = context.rootGetters.userId;
|
||||
const token = context.rootGetters.token;
|
||||
const axiosConfig = {
|
||||
params: { auth: token }
|
||||
};
|
||||
|
||||
try {
|
||||
const coachId = context.rootGetters.userId;
|
||||
const response = await getAPI.get(`requests/${coachId}.json`);
|
||||
const response = await getAPI.get(
|
||||
`requests/${coachId}.json`,
|
||||
axiosConfig
|
||||
);
|
||||
const responseData = await response.data;
|
||||
|
||||
const requests = [];
|
||||
|
|
Reference in New Issue