Send generated local_id with create payload
This commit is contained in:
parent
20cf1789dd
commit
6b83f81eb6
1 changed files with 9 additions and 1 deletions
|
|
@ -59,7 +59,7 @@ const Party = (props: Props) => {
|
|||
if (details) payload = formatDetailsObject(details)
|
||||
|
||||
return await api.endpoints.parties
|
||||
.create(payload)
|
||||
.create({ ...payload, ...localId() })
|
||||
.then((response) => storeParty(response.data.party))
|
||||
}
|
||||
|
||||
|
|
@ -69,6 +69,14 @@ const Party = (props: Props) => {
|
|||
else updateParty(details)
|
||||
}
|
||||
|
||||
function localId() {
|
||||
const cookie = accountCookie()
|
||||
const parsed = JSON.parse(cookie as string)
|
||||
if (parsed && !parsed.token) {
|
||||
return { local_id: parsed.userId }
|
||||
} else return {}
|
||||
}
|
||||
|
||||
function formatDetailsObject(details: DetailsObject) {
|
||||
const payload: { [key: string]: any } = {}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue