mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: use username instead of uid (#1977)
* #1916 replace userId to username * resolve --------- Co-authored-by: Александр Тумайкин <AATumaykin@tsum.ru>
This commit is contained in:
committed by
GitHub
parent
336b32004d
commit
f91f09adea
@ -56,8 +56,8 @@ export function getUserList() {
|
||||
return axios.get<User[]>("/api/v1/user");
|
||||
}
|
||||
|
||||
export function getUserById(id: number) {
|
||||
return axios.get<User>(`/api/v1/user/${id}`);
|
||||
export function getUserByUsername(username: string) {
|
||||
return axios.get<User>(`/api/v1/user/${username}`);
|
||||
}
|
||||
|
||||
export function upsertUserSetting(upsert: UserSettingUpsert) {
|
||||
@ -81,13 +81,17 @@ export function getAllMemos(memoFind?: MemoFind) {
|
||||
queryList.push(`limit=${memoFind.limit}`);
|
||||
}
|
||||
|
||||
if (memoFind?.creatorUsername) {
|
||||
queryList.push(`creatorUsername=${memoFind.creatorUsername}`);
|
||||
}
|
||||
|
||||
return axios.get<Memo[]>(`/api/v1/memo/all?${queryList.join("&")}`);
|
||||
}
|
||||
|
||||
export function getMemoList(memoFind?: MemoFind) {
|
||||
const queryList = [];
|
||||
if (memoFind?.creatorId) {
|
||||
queryList.push(`creatorId=${memoFind.creatorId}`);
|
||||
if (memoFind?.creatorUsername) {
|
||||
queryList.push(`creatorUsername=${memoFind.creatorUsername}`);
|
||||
}
|
||||
if (memoFind?.rowStatus) {
|
||||
queryList.push(`rowStatus=${memoFind.rowStatus}`);
|
||||
@ -104,8 +108,8 @@ export function getMemoList(memoFind?: MemoFind) {
|
||||
return axios.get<Memo[]>(`/api/v1/memo?${queryList.join("&")}`);
|
||||
}
|
||||
|
||||
export function getMemoStats(userId: UserId) {
|
||||
return axios.get<number[]>(`/api/v1/memo/stats?creatorId=${userId}`);
|
||||
export function getMemoStats(username: string) {
|
||||
return axios.get<number[]>(`/api/v1/memo/stats?creatorUsername=${username}`);
|
||||
}
|
||||
|
||||
export function getMemoById(id: MemoId) {
|
||||
@ -163,8 +167,8 @@ export async function chatStreaming(messageList: Array<Message>, onmessage: any,
|
||||
|
||||
export function getShortcutList(shortcutFind?: ShortcutFind) {
|
||||
const queryList = [];
|
||||
if (shortcutFind?.creatorId) {
|
||||
queryList.push(`creatorId=${shortcutFind.creatorId}`);
|
||||
if (shortcutFind?.creatorUsername) {
|
||||
queryList.push(`creatorUsername=${shortcutFind.creatorUsername}`);
|
||||
}
|
||||
return axios.get<Shortcut[]>(`/api/v1/shortcut?${queryList.join("&")}`);
|
||||
}
|
||||
@ -228,8 +232,8 @@ export function deleteMemoResource(memoId: MemoId, resourceId: ResourceId) {
|
||||
|
||||
export function getTagList(tagFind?: TagFind) {
|
||||
const queryList = [];
|
||||
if (tagFind?.creatorId) {
|
||||
queryList.push(`creatorId=${tagFind.creatorId}`);
|
||||
if (tagFind?.creatorUsername) {
|
||||
queryList.push(`creatorUsername=${tagFind.creatorUsername}`);
|
||||
}
|
||||
return axios.get<string[]>(`/api/v1/tag?${queryList.join("&")}`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user