Skip to content

Commit ff27108

Browse files
committed
fix(cli): use || instead of ?? because getEndpoint() can return ""
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.
1 parent 2dd681f commit ff27108

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/cli/lib/commands/generic.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1';
1414
const loginCommand = async ({ email, password, endpoint, mfa, code }) => {
1515
const oldCurrent = globalConfig.getCurrentSession();
1616

17-
const configEndpoint = endpoint ?? globalConfig.getEndpoint() ?? DEFAULT_ENDPOINT;
17+
const configEndpoint = (endpoint ?? globalConfig.getEndpoint()) || DEFAULT_ENDPOINT;
1818

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

0 commit comments

Comments
 (0)