MapComplete/src/land.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
613 B
TypeScript
Raw Normal View History

2023-09-21 15:29:34 +02:00
import { OsmConnection } from "./Logic/Osm/OsmConnection"
import Constants from "./Models/Constants"
2023-09-01 21:36:39 +02:00
2023-09-21 15:29:34 +02:00
console.log("Authorizing...")
const key = Constants.osmAuthConfig.url + "oauth2_state"
2025-02-10 02:04:58 +01:00
const st = window.localStorage.getItem(key)
console.log("Prev state is", key, st)
2023-09-21 15:29:34 +02:00
new OsmConnection().finishLogin((previousURL) => {
const fallback = window.location.protocol + "//" + window.location.host + "/index.html"
2023-09-01 21:36:39 +02:00
previousURL ??= fallback
2023-09-21 15:29:34 +02:00
if (previousURL.indexOf("/land") > 0) {
2023-09-01 21:36:39 +02:00
previousURL = fallback
}
console.log("Redirecting to", previousURL)
window.location.href = previousURL
})