update
This commit is contained in:
@@ -3,37 +3,37 @@ import axios from 'axios';
|
||||
export default {
|
||||
getArticles({page = 0, size = 10, q = ''}, authorization) {
|
||||
|
||||
const request = axios({
|
||||
const options = {
|
||||
url: '/api/articles',
|
||||
params: {
|
||||
page,
|
||||
size,
|
||||
q
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (authorization) {
|
||||
request.headers = {
|
||||
options.headers = {
|
||||
'Authorization': authorization
|
||||
};
|
||||
}
|
||||
|
||||
return request;
|
||||
return axios(options);
|
||||
},
|
||||
getArticle({articleId}, authorization) {
|
||||
const request = axios({
|
||||
const options = {
|
||||
url: '/api/articles/' + articleId,
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
if (authorization) {
|
||||
request.headeres = {
|
||||
options.headers = {
|
||||
'Authorization': authorization
|
||||
}
|
||||
}
|
||||
|
||||
return request;
|
||||
console.log(options);
|
||||
|
||||
return axios(options);
|
||||
},
|
||||
postArticle({title = '', content = ''}, authorization) {
|
||||
|
||||
|
||||
@@ -20,9 +20,11 @@ export default {
|
||||
},
|
||||
async getArticle(articleId) {
|
||||
try {
|
||||
const authorization = commonUtil.getAuthenticationHeaderBearer(this.$cookie.get('accessToken'));
|
||||
const result = await articleApi.getArticle({articleId}, authorization);
|
||||
return result.data;
|
||||
const accessToken = this.$cookie.get('accessToken');
|
||||
const authorization = commonUtil.getAuthenticationHeaderBearer(accessToken);
|
||||
|
||||
const {data} = await articleApi.getArticle({articleId}, authorization);
|
||||
return data;
|
||||
} catch (err) {
|
||||
alert('문제가 발생하였습니다.');
|
||||
console.log(err);
|
||||
|
||||
Reference in New Issue
Block a user