Skip to content

Commit

Permalink
fix(cli): use || instead of ??`` because getEndpoint() can return ""
Browse files Browse the repository at this point in the history
Since the `??`` operator only returns the right side if the left side is
null or undefined, it will not work if getEndpoint() returns an empty
string. `||`, however, will return the right side if the left side is
an empty string.
  • Loading branch information
stnguyen90 committed Sep 19, 2024
1 parent 2dd681f commit 51ee938
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/cli/lib/commands/generic.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1';
const loginCommand = async ({ email, password, endpoint, mfa, code }) => {
const oldCurrent = globalConfig.getCurrentSession();

const configEndpoint = endpoint ?? globalConfig.getEndpoint() ?? DEFAULT_ENDPOINT;
const configEndpoint = (endpoint ?? globalConfig.getEndpoint()) || DEFAULT_ENDPOINT;

if (globalConfig.getCurrentSession() !== '') {
log('You are currently signed in as ' + globalConfig.getEmail());
Expand Down

0 comments on commit 51ee938

Please sign in to comment.