Skip to content

Avoid using global state #10

@benfoxall

Description

@benfoxall

Currently there's single global state which stores the user account details and connection token. This means that you can't access trackers for multiple users.

If instead the module exported a client that could be initialised, then credentials could be held within that object:

import { Client } from 'tractive'

const client = new Client('username', 'password')

await client.getTrackers()


const client2 = new Client('username2', 'password2')

await client2.getTrackers()

It would be possible to maintain the current api alongside if desirable (maybe with a deprecated notice?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions