-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add redirct on unauthorized interceptor and return null in loader * increment versions
- Loading branch information
1 parent
3517505
commit 802318e
Showing
6 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { describe, expect, it, vi } from 'vitest'; | ||
import { AxiosResponse } from 'axios'; | ||
import { returnOnSuccess } from '~/services/APIs/htApi'; | ||
import { undefined } from 'zod'; | ||
|
||
vi.mock('react-router-dom', () => ({ | ||
redirect: vi.fn(), | ||
})); | ||
|
||
const createMockResponse = (status: number): AxiosResponse => ({ | ||
// @ts-expect-error - ok for test | ||
config: {}, | ||
data: undefined, | ||
headers: {}, | ||
status, | ||
statusText: '', | ||
}); | ||
|
||
describe('htApi response interceptor', () => { | ||
it('returns same response', async () => { | ||
const response = createMockResponse(200); | ||
const returnedResponse = returnOnSuccess(response); | ||
expect(returnedResponse).toBe(response); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "haztrak", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters