Update the code to download the changeset metadata, this endpoint changed (!)

This commit is contained in:
Pieter Vander Vennet 2024-08-26 01:06:50 +02:00
parent 006941d21b
commit 407384cc23
2 changed files with 7 additions and 5 deletions

View file

@ -237,9 +237,9 @@ export class Changes {
console.log("Uploading changes due to: ", flushreason)
this.isUploading.setData(true)
try {
const csNumber = await this.flushChangesAsync()
await this.flushChangesAsync()
this.isUploading.setData(false)
console.log("Changes flushed. Your changeset is " + csNumber)
console.log("Changes flushed")
this.errors.setData([])
} catch (e) {
this._reportError(e)

View file

@ -14,10 +14,10 @@ export interface ChangesetTag {
}
export type ChangesetMetadata = {
type: "changeset"
id: number
created_at: string
open: boolean
closed_at?: string
uid: number
user: string
changes_count: number
@ -164,10 +164,12 @@ export class ChangesetHandler {
return
}
console.log("Trying to reuse changeset", openChangeset.data)
if (openChangeset.data) {
try {
const csId = openChangeset.data
const oldChangesetMeta = await this.GetChangesetMeta(csId)
console.log("Got metadata:", oldChangesetMeta, "isopen", oldChangesetMeta?.open)
if (oldChangesetMeta.open) {
// We can hopefully reuse the changeset
@ -357,8 +359,8 @@ export class ChangesetHandler {
private async GetChangesetMeta(csId: number): Promise<ChangesetMetadata> {
const url = `${this.backend}/api/0.6/changeset/${csId}`
const csData = await Utils.downloadJson<{ elements: ChangesetMetadata[] }>(url)
return csData.elements[0]
const csData = await Utils.downloadJson<{ changeset: ChangesetMetadata }>(url)
return csData.changeset
}
/**