diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-04-04 22:58:26 -0400 | 
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-04-04 22:58:26 -0400 | 
| commit | f70e86470f7083cda1949ff97556d9e39578ce1d (patch) | |
| tree | 5cc8a3e1089409e10fd92896625605a7f8f6897b /ufund-ui/src/app/services | |
| parent | edfc9a8450d140ba1650b38e4b707000710b2faa (diff) | |
| parent | 5a5d31896d79a736bce33b7d1aa7b3168ba308a9 (diff) | |
| download | JellySolutions-f70e86470f7083cda1949ff97556d9e39578ce1d.tar.gz JellySolutions-f70e86470f7083cda1949ff97556d9e39578ce1d.tar.bz2 JellySolutions-f70e86470f7083cda1949ff97556d9e39578ce1d.zip  | |
Merge branch 'main' into need-list-abstraction
# Conflicts:
#	ufund-ui/src/app/components/cupboard/cupboard.component.ts
#	ufund-ui/src/app/components/funding-basket/funding-basket.component.html
#	ufund-ui/src/app/components/funding-basket/funding-basket.component.ts
#	ufund-ui/src/app/components/need-list/need-list.component.html
#	ufund-ui/src/app/components/need-list/need-list.component.ts
#	ufund-ui/src/app/components/need-page/need-page.component.html
Diffstat (limited to 'ufund-ui/src/app/services')
| -rw-r--r-- | ufund-ui/src/app/services/cupboard.service.ts | 4 | ||||
| -rw-r--r-- | ufund-ui/src/app/services/users.service.ts | 13 | 
2 files changed, 15 insertions, 2 deletions
diff --git a/ufund-ui/src/app/services/cupboard.service.ts b/ufund-ui/src/app/services/cupboard.service.ts index 694bb94..a87dee2 100644 --- a/ufund-ui/src/app/services/cupboard.service.ts +++ b/ufund-ui/src/app/services/cupboard.service.ts @@ -47,7 +47,7 @@ export class CupboardService {          return this.http.delete<boolean>(`${this.url}/${id}`, this.httpOptions())      } -    checkoutNeed(id: number, quantity: number) { -        return this.http.put(`${this.url}/checkout`, {needID: id, amount: quantity}, this.httpOptions()) +    checkoutNeed(data: {needID: number, quantity: number}[]) { +        return this.http.put(`${this.url}/checkout`, data, this.httpOptions())      }  } diff --git a/ufund-ui/src/app/services/users.service.ts b/ufund-ui/src/app/services/users.service.ts index d23b59b..35d080d 100644 --- a/ufund-ui/src/app/services/users.service.ts +++ b/ufund-ui/src/app/services/users.service.ts @@ -21,6 +21,15 @@ export class UsersService {          })      }); +    httpOptions2 = () => ({ +        headers: new HttpHeaders({ +            'Content-Type': 'application/json', +            "jelly-api-key": this.authService.getApiKey() +        }), +        responseType: "text" as "json" // don't ask me how or why this works, bc i have no clue... +        // see the relevant angular bug report https://github.com/angular/angular/issues/18586 +    }); +      constructor(          private http: HttpClient,          private cupboardService: CupboardService, @@ -37,6 +46,10 @@ export class UsersService {          return this.http.get<User>(`${this.url}/${id}`, this.httpOptions())      } +    getCount(): Observable<number> { +        return this.http.get<number>(`${this.url}/count`, this.httpOptions2()) +    } +      updateUser(user: User): Observable<User> {          console.log(`${this.url}/${user.username}`, user, this.httpOptions)          return this.http.put<User>(`${this.url}/${user.username}`, user, this.httpOptions())  | 
