feat(dashboard,js-sdk,types): Update app layout, and add user sdk methods (#8182)
**What** - Updates app layout (sidebar and topbar) - Adds "System" option to theme toggle (we now default to system) - Adds sdk methods for user endpoints (RESOLVES CC-67)
This commit is contained in:
committed by
GitHub
parent
07205e4249
commit
75c5d5ad9e
@@ -23,6 +23,7 @@ import { Store } from "./store"
|
||||
import { TaxRate } from "./tax-rate"
|
||||
import { TaxRegion } from "./tax-region"
|
||||
import { Upload } from "./upload"
|
||||
import { User } from "./user"
|
||||
|
||||
export class Admin {
|
||||
public invite: Invite
|
||||
@@ -48,6 +49,7 @@ export class Admin {
|
||||
public taxRegion: TaxRegion
|
||||
public store: Store
|
||||
public productTag: ProductTag
|
||||
public user: User
|
||||
public return: Return
|
||||
|
||||
constructor(client: Client) {
|
||||
@@ -74,6 +76,7 @@ export class Admin {
|
||||
this.taxRegion = new TaxRegion(client)
|
||||
this.store = new Store(client)
|
||||
this.productTag = new ProductTag(client)
|
||||
this.user = new User(client)
|
||||
this.return = new Return(client)
|
||||
}
|
||||
}
|
||||
|
||||
81
packages/core/js-sdk/src/admin/user.ts
Normal file
81
packages/core/js-sdk/src/admin/user.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class User {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async create(
|
||||
body: HttpTypes.AdminCreateUser,
|
||||
query?: HttpTypes.AdminUserParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return this.client.fetch<HttpTypes.AdminUserResponse>(`/admin/users`, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
})
|
||||
}
|
||||
|
||||
async update(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateUser,
|
||||
query?: HttpTypes.AdminUserParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return this.client.fetch<HttpTypes.AdminUserResponse>(
|
||||
`/admin/users/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async list(
|
||||
queryParams?: HttpTypes.AdminUserListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return this.client.fetch<HttpTypes.AdminUserListResponse>(`/admin/users`, {
|
||||
headers,
|
||||
query: queryParams,
|
||||
})
|
||||
}
|
||||
|
||||
async retrieve(
|
||||
id: string,
|
||||
query?: HttpTypes.AdminUserParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return this.client.fetch<HttpTypes.AdminUserResponse>(
|
||||
`/admin/users/${id}`,
|
||||
{
|
||||
query,
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async delete(id: string, headers?: ClientHeaders) {
|
||||
return this.client.fetch<HttpTypes.AdminUserDeleteResponse>(
|
||||
`/admin/users/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async me(query?: HttpTypes.AdminUserParams, headers?: ClientHeaders) {
|
||||
return this.client.fetch<HttpTypes.AdminUserResponse>(`/admin/users/me`, {
|
||||
query,
|
||||
headers,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user