Skip to content

Commit

Permalink
bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
iranathan committed Nov 30, 2023
1 parent 06297f0 commit 91b9933
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 1 addition & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ export default class Client {
}

changeToken(token) {
this.session.session.interceptors.request.use(function (config) {
config.headers.Authorization = `Bearer ${token}`;
return config;
});
this.session.token = token
}

async getPersonalia() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "osiris.js",
"version": "1.0.6",
"version": "1.0.7",
"description": "An api wrapper for osiris in Grafisch Lyceum Rotterdam.",
"main": "index.js",
"type": "module",
Expand Down
9 changes: 5 additions & 4 deletions utils/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ class NotAuthenticated extends Error {

export default class RequestSession {
constructor(token, baseURL) {
this.token = token;
this.session = axios.create({
baseURL: baseURL,
headers: {
'authorization': `Bearer ${token}`,
}
baseURL: baseURL
});
}

async request(url, method, data) {
const res = await this.session.request({
url: url,
method: method,
headers: {
'authorization': `Bearer ${this.token}`,
},
data: data,
validateStatus: () => true
});
Expand Down

0 comments on commit 91b9933

Please sign in to comment.