mirror of
https://github.com/IliesAllali/parenthese.git
synced 2026-11-16 16:33:28 +00:00
Immich : demander confirmation avant de remplacer un portrait existant
L'association remplaçait et supprimait le portrait en place sans rien demander. Le serveur refuse maintenant le remplacement d'un portrait existant (409 avatar_exists), quelle que soit son origine, tant que la requête ne porte pas replaceAvatar ; le panneau Immich transforme ce refus en demande de confirmation avant de rejouer la requête. Sans vignette Immich, l'association ne touche pas au portrait et aucune confirmation n'est demandée. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
1 parent
a3386824d3
commit
0bda88920d
6 files changed
+121
-13
No files matched your search
@@ -70,10 +70,12 @@ export async function fetchImmichThumbnail(treeId, immichPersonId, token) {
|
||||
return URL.createObjectURL(await response.blob())
|
||||
}
|
||||
|
||||
export async function assignImmichPerson(treeId, personId, immichPersonId, token) {
|
||||
export async function assignImmichPerson(treeId, personId, immichPersonId, token, { replaceAvatar = false } = {}) {
|
||||
return apiRequest(`/trees/${encodeURIComponent(treeId)}/immich/assign`, withAuth({
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ personId, immichPersonId }),
|
||||
// replaceAvatar : accord explicite pour remplacer un portrait déjà en place — le serveur
|
||||
// refuse sinon (409 avatar_exists), quelle que soit l'origine du portrait actuel.
|
||||
body: JSON.stringify({ personId, immichPersonId, ...(replaceAvatar ? { replaceAvatar: true } : {}) }),
|
||||
}, token))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user