summaryrefslogtreecommitdiff
path: root/src/connector.js
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-06-17 22:33:24 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-06-17 22:33:24 -0500
commit01482068726ee6de5336ed01bfadaeaaaf02666e (patch)
tree041e50f7a877551ecf2ec3c8df927fe6ac5aeb86 /src/connector.js
parentecc580218ac64cc5d42b197bdaf9d15bd551d64b (diff)
downloadimmich-frame-01482068726ee6de5336ed01bfadaeaaaf02666e.tar.xz
immich-frame-01482068726ee6de5336ed01bfadaeaaaf02666e.zip
settings page save/load config
Diffstat (limited to 'src/connector.js')
-rw-r--r--src/connector.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/connector.js b/src/connector.js
index 97071c6..29f0cff 100644
--- a/src/connector.js
+++ b/src/connector.js
@@ -19,12 +19,8 @@ class APIConnector {
})
}
- #fetch(endpoint) {
- return fetch(this.url + "/api" + endpoint)
- }
-
- fetch(endpoint) {
- return this.#fetch(endpoint)
+ fetch(endpoint, c) {
+ return fetch(this.url + "/api" + endpoint, c ?? {})
.then(response => {
if (!response.ok)
throw new Error(`HTTP error! Status: ${response.status}`)
@@ -38,14 +34,21 @@ class APIConnector {
})
}
+ post(endpoint, body) {
+ return this.fetch(endpoint, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(body),
+ })
+ }
+
seek(increment) {
- //return this.fetch(`/seek?increment=${increment}`)
this.socket.emit("seek", increment)
}
- fetchAlbums() {
- return this.fetch("/albums")
- }
+ fetchAlbums() { return this.fetch("/albums") }
+ fetchConfig() { return this.fetch("/config") }
+ updateConfig(config) { return this.post("/config/update", config) }
albumSrc(key) { return `${this.url}/api/redirect/albums/${key}` }
assetSrc(key) { return `${this.url}/api/asset/${key}` }