Merge branch 'feat/larandegruppen' of https://github.com/kolplattformen/skolplattformen into feat/larandegruppen
This commit is contained in:
commit
959b17bbab
|
@ -302,12 +302,18 @@ export class ApiAdmentum extends EventEmitter implements Api {
|
|||
if (!this.isLoggedIn) {
|
||||
throw new Error('Not logged in...')
|
||||
}
|
||||
const token = await this.fetch('get-token', apiUrls.messages)
|
||||
.then((res) => res.text())
|
||||
.then((html) => /token:\s+'(.*)'/.exec(html)?.pop()) // HACK: this could probably be found at a better place than the html code..
|
||||
|
||||
const fetchUrl = apiUrls.messages(this.userId, '1')
|
||||
console.log('token', token)
|
||||
|
||||
const fetchUrl = apiUrls.conversations(this.userId, '1')
|
||||
console.log('fetching messages', fetchUrl)
|
||||
const messagesResponse = await this.fetch('get-messages', fetchUrl, {
|
||||
headers: {
|
||||
'x-requested-with': 'XMLHttpRequest',
|
||||
'user-info': token,
|
||||
},
|
||||
})
|
||||
const messagesResponseJson = await messagesResponse.json()
|
||||
|
|
|
@ -15,9 +15,10 @@ export const apiUrls = {
|
|||
leisure_groups: api + 'leisure_groups',
|
||||
lesson_infos: api + 'lesson_infos',
|
||||
lessons: api + 'lessons',
|
||||
messages: 'https://skola.admentum.se/messages/',
|
||||
// start at page 1
|
||||
messages: (userId: string, page: string) =>
|
||||
`https://messages.admentum.se/api/users/${userId}/conversations?page=${page}`, // unread_only=1
|
||||
conversations: (userId: string, page: string) =>
|
||||
`https://messages.admentum.se/api/users/${userId}/conversations?page=${page}`, // unread_only=1
|
||||
organisations: api + 'organisations',
|
||||
orientations: api + 'orientations',
|
||||
overview: (action: string, year: string, week: string) =>
|
||||
|
|
Loading…
Reference in New Issue