feat(frontend): Implement reactive refresh interceptor
This commit is contained in:
@@ -83,4 +83,19 @@ describe("AuthService", () => {
|
||||
await AuthService.logout()
|
||||
expect(mockedApi.post).toHaveBeenCalledWith("/auth/logout")
|
||||
})
|
||||
|
||||
it("successfully refreshes session", async () => {
|
||||
const mockResponse = {
|
||||
data: {
|
||||
access_token: "new-fake-token",
|
||||
token_type: "bearer",
|
||||
},
|
||||
}
|
||||
mockedApi.post.mockResolvedValueOnce(mockResponse)
|
||||
|
||||
const result = await AuthService.refreshSession()
|
||||
|
||||
expect(mockedApi.post).toHaveBeenCalledWith("/auth/refresh")
|
||||
expect(result.access_token).toBe("new-fake-token")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user