Skip to content

Commit

Permalink
bug: fixed router navigating to homepage on page loads
Browse files Browse the repository at this point in the history
  • Loading branch information
david-kalmakoff committed Nov 5, 2024
1 parent 3f29ded commit 2e1f27d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ui/src/CurrentUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export class CurrentUser {
};

public tryAuthenticate = async (): Promise<AxiosResponse<IUser>> => {
this.authenticating = true;
if (this.token() === '') {
this.authenticating = false;
return Promise.reject();
}

Expand All @@ -111,11 +113,13 @@ export class CurrentUser {
.then((passThrough) => {
this.user = passThrough.data;
this.loggedIn = true;
this.authenticating = false;
this.connectionErrorMessage = null;
this.reconnectTime = 7500;
return passThrough;
})
.catch((error: AxiosError) => {
this.authenticating = false;
if (!error || !error.response) {
this.connectionError('No network connection or server unavailable.');
return Promise.reject(error);
Expand Down
4 changes: 2 additions & 2 deletions ui/src/tests/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const $dialog = selector.form('#add-edit-user-dialog');

describe('User', () => {
it('does login', async () => await auth.login(page));
it('navigates to users', async () => {
await page.click('#navigate-users');
it('navigates to users through window location', async () => {
await page.goto(gotify.url + '/#/users');
await waitForExists(page, selector.heading(), 'Users');
});
it('has changed url', async () => {
Expand Down

0 comments on commit 2e1f27d

Please sign in to comment.