entity
entity copied to clipboard
Bug - Update to TOS API not reflected in UI Code
The recent TOS API Update is not handled correctly by the UI Code.
The API has changed its field names and requires both fields to be populated in case of setting acceptance to true or false. I looked into this in the code and found a couple of changes that are needed:
In terms-of-service.vue : Change:
<BcrosButtonsPrimary
:label="tTos('decline')"
:action="() => handleAcceptTermsOfService(false)"
variant="outline"
class-name="ml-[4px]"
/>
to
<BcrosButtonsPrimary
:label="tTos('decline')"
:action="() => handleAcceptTermsOfService(false, tos?.versionId)"
variant="outline"
class-name="ml-[4px]"
/>
In account.ts: Change:
async function acceptTos (acceptance: boolean, versionId?: string): Promise<TermsOfServiceI | void> {
return await axiosInstance.patch<TermsOfServiceI>(`${strrApiURL}/account`,
{
acceptTermsAndConditions: acceptance,
termsVersion: versionId
}
)
.then(() => {
setAccountInfo()
.then(() => {
navigateTo('/create-account')
})
})
to:
async function acceptTos(
acceptance: boolean,
versionId?: string
): Promise<TermsOfServiceI | void> {
return await axiosInstance
.patch<TermsOfServiceI>(`${strrApiURL}/users/tos`, {
istermsaccepted: acceptance,
termsversion: versionId,
})
.then(() => {
setAccountInfo().then(() => {
if (acceptance) {
navigateTo("/create-account");
} else {
navigateTo("/");
}
});
});
Note: The endpoint changed and the parameter names. Also the routing is case on non-acceptance is set to the route.