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