Skip to content

Commit

Permalink
fix(tasks): refresh waves on login
Browse files Browse the repository at this point in the history
  • Loading branch information
esoadamo committed Nov 10, 2024
1 parent da40897 commit e8656e9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
16 changes: 16 additions & 0 deletions src/api/backend/api/default.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4840,6 +4840,14 @@ export class DefaultService {
headers = headers.set('year', String(year));
}

// authentication (ksi) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}

// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json'
Expand Down Expand Up @@ -4881,6 +4889,14 @@ export class DefaultService {

let headers = this.defaultHeaders;

// authentication (ksi) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}

// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json'
Expand Down
8 changes: 4 additions & 4 deletions src/api/edulint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ paths:
summary: List of currently supported Edulint versions.
responses:
"200":
description: The versions are sorted -- the newest version is listed first.
description: Different EduLint versions are currently not supported. Endpoint returns only "latest".
content:
application/json:
schema:
type: array
items:
type: string
example: ["2.10.2", "2.9.2"]
example: ["latest"]

/api/code:
post:
Expand Down Expand Up @@ -128,7 +128,7 @@ paths:
parameters:
- name: version
in: path
description: The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or "latest".
description: The version of EduLint to use. Currently, you can only use "latest".
required: true
schema:
type: string
Expand Down Expand Up @@ -171,7 +171,7 @@ paths:
parameters:
- name: version
in: path
description: The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or "latest".
description: The version of EduLint to use. Currently, you can only use "latest".
required: true
schema:
type: string
Expand Down
4 changes: 2 additions & 2 deletions src/api/edulint/api/aPI.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class APIService {
/**
* Analyzes the code with the given hash with the given version of EduLint
*
* @param version The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or \"latest\".
* @param version The version of EduLint to use. Currently, you can only use \"latest\".
* @param hash the hash of the code to analyze
* @param config extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)).
* @param use_cached_result enables/disables using cached linting results
Expand Down Expand Up @@ -212,7 +212,7 @@ export class APIService {
* Uploads some code and returns its analysis
* This endpoint combines the /code and /api/{version}/analyze/{hash} endpoints.
* @param body the code to upload and analyze
* @param version The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or \"latest\".
* @param version The version of EduLint to use. Currently, you can only use \"latest\".
* @param config extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)).
* @param use_cached_result enables/disables using cached linting results
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
Expand Down
5 changes: 4 additions & 1 deletion src/app/services/tasks/tasks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export class TasksService {
shareReplay(1)
);

this.waves$ = year.selected$.pipe(
this.waves$ = merge(
backend.user$.pipe(map(() => this.year.selected)),
year.selected$
).pipe(
mergeMap((year) => this.backend.http.wavesGetAll(year?.id)),
map((response) => {
const {waves} = response;
Expand Down

0 comments on commit e8656e9

Please sign in to comment.