Skip to content

Commit 4e65142

Browse files
committed
revert changes to other files
1 parent 3b11dc3 commit 4e65142

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

site/src/api/index.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from "axios"
22
import { getApiKey, login, logout } from "."
3-
import { GenerateAPIKeyResponse, LoginWithPasswordResponse } from "./types"
3+
import { APIKeyResponse, LoginResponse } from "./types"
44

55
// Mock the axios module so that no real network requests are made, but rather
66
// we swap in a resolved or rejected value
@@ -10,9 +10,9 @@ jest.mock("axios")
1010

1111
describe("api.ts", () => {
1212
describe("login", () => {
13-
it("should return LoginWithPasswordResponse", async () => {
13+
it("should return LoginResponse", async () => {
1414
// given
15-
const loginResponse: LoginWithPasswordResponse = {
15+
const loginResponse: LoginResponse = {
1616
session_token: "abc_123_test",
1717
}
1818
const axiosMockPost = jest.fn().mockImplementationOnce(() => {
@@ -87,7 +87,7 @@ describe("api.ts", () => {
8787
describe("getApiKey", () => {
8888
it("should return APIKeyResponse", async () => {
8989
// given
90-
const apiKeyResponse: GenerateAPIKeyResponse = {
90+
const apiKeyResponse: APIKeyResponse = {
9191
key: "abc_123_test",
9292
}
9393
const axiosMockPost = jest.fn().mockImplementationOnce(() => {

site/src/api/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ export namespace Workspace {
4343
}
4444
}
4545

46-
export const login = async (email: string, password: string): Promise<Types.LoginWithPasswordResponse> => {
46+
export const login = async (email: string, password: string): Promise<Types.LoginResponse> => {
4747
const payload = JSON.stringify({
4848
email,
4949
password,
5050
})
5151

52-
const response = await axios.post<Types.LoginWithPasswordResponse>("/api/v2/users/login", payload, {
52+
const response = await axios.post<Types.LoginResponse>("/api/v2/users/login", payload, {
5353
headers: { ...CONTENT_TYPE_JSON },
5454
})
5555

@@ -60,8 +60,8 @@ export const logout = async (): Promise<void> => {
6060
await axios.post("/api/v2/users/logout")
6161
}
6262

63-
export const getUser = async (): Promise<Types.User> => {
64-
const response = await axios.get<Types.User>("/api/v2/users/me")
63+
export const getUser = async (): Promise<Types.UserResponse> => {
64+
const response = await axios.get<Types.UserResponse>("/api/v2/users/me")
6565
return response.data
6666
}
6767

@@ -71,7 +71,7 @@ export const getApiKey = async (): Promise<Types.APIKeyResponse> => {
7171
}
7272

7373
export const getUsers = async (): Promise<Types.PagedUsers> => {
74-
// const response = await axios.get<Types.User[]>("/api/v2/users")
74+
// const response = await axios.get<Types.UserResponse[]>("/api/v2/users")
7575
// return response.data
7676
return Promise.resolve({
7777
page: [MockUser, MockUser2],
@@ -104,7 +104,7 @@ export const putWorkspaceAutostop = async (
104104
})
105105
}
106106

107-
export const updateProfile = async (userId: string, data: Types.UpdateProfileRequest): Promise<Types.User> => {
107+
export const updateProfile = async (userId: string, data: Types.UpdateProfileRequest): Promise<Types.UserResponse> => {
108108
const response = await axios.put(`/api/v2/users/${userId}/profile`, data)
109109
return response.data
110110
}

site/src/test_helpers/entities.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Provisioner,
66
Template,
77
UserAgent,
8-
User,
8+
UserResponse,
99
Workspace,
1010
WorkspaceAutostartRequest,
1111
} from "../api/types"
@@ -19,15 +19,15 @@ export const MockBuildInfo: BuildInfoResponse = {
1919
version: "v99.999.9999+c9cdf14",
2020
}
2121

22-
export const MockUser: User = {
22+
export const MockUser: UserResponse = {
2323
name: "Test User",
2424
id: "test-user",
2525
username: "TestUser",
2626
email: "test@coder.com",
2727
created_at: "",
2828
}
2929

30-
export const MockUser2: User = {
30+
export const MockUser2: UserResponse = {
3131
id: "test-user-2",
3232
name: "Test User 2",
3333
username: "TestUser2",

site/src/xServices/auth/authXService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface AuthContext {
1010
getUserError?: Error | unknown
1111
authError?: Error | unknown
1212
updateProfileError?: Error | unknown
13-
me?: Types.User
13+
me?: Types.UserResponse
1414
}
1515

1616
export type AuthEvent =
@@ -29,13 +29,13 @@ export const authMachine =
2929
events: {} as AuthEvent,
3030
services: {} as {
3131
getMe: {
32-
data: Types.User
32+
data: Types.UserResponse
3333
}
3434
signIn: {
35-
data: Types.LoginWithPasswordResponse
35+
data: Types.LoginResponse
3636
}
3737
updateProfile: {
38-
data: Types.User
38+
data: Types.UserResponse
3939
}
4040
},
4141
},

0 commit comments

Comments
 (0)