Skip to content

user.data not updated when changing deactivated to false and setting data (formerly: observe current user not working when evaluation expired or deactivated) #2158

@retotito

Description

@retotito

Hy
I'm observing the currentUser, to be able to notify the user inside the app, if a users evaluation or subscription expires or a subscription started.

const userObservable = dexieJS.db.cloud.currentUser

In cases of subscription expire or starting, i use the dexieCloudRestAPI to set the "type" and so on.

This works great as long as
"type" is "prod", "valid until" is a date in the future and "deactivated" is "false" or "undefined.
or
"type" is "eval", "valid until" is a date in the future and "deactivated" is "false" or "undefined.

But when "valid until" is in the past or "deactivated" is "true"(or a date),
from then on the observer is not working anymore, because there is a HttpError: 403 with the dexieCloudAddon.

When the "type" is set back to "prod" via dexieCloudRestAPI, because the user purchased a subscription on Stripe or somewhere else,
then the app has to be restarted to connect to the cloud again.
Sometimes you also have to restart twice, to reconnect.

Is there any solution in Dexie for that usecase?
Or is my concept totally wrong?

Thanks for some answers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions