-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
44 lines (40 loc) · 960 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const { MyMICDS } = require('./dist');
const fs = require('fs');
const { Observable } = require('rxjs');
const { tap, switchMap } = require('rxjs/operators');
const jwtStore = {
jwt: ''
};
const options = {
baseURL: 'http://localhost:1420',
jwtGetter() {
return jwtStore.jwt;
},
jwtSetter(jwt, remember) {
jwtStore.jwt = jwt;
jwtStore.remember = remember;
},
jwtClear() {
delete jwtStore.jwt;
delete jwtStore.remember;
}
};
const api = new MyMICDS(options);
api.auth.login({ user: 'foo', password: 'bar' }).pipe(
switchMap(() => api.canvas.getUniqueEvents())
).subscribe(
data => console.log('Response', data),
err => console.log('Error!', err)
);
api.auth.$.subscribe(
auth => console.log('Auth', auth),
err => console.log('Auth Error', err)
);
// api.suggestion.submit({ submission: 'holy shy SDK is done' }).subscribe(
// data => {
// console.log('data', data);
// },
// err => {
// console.log('error!', err);
// }
// );