mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-11-30 11:27:55 +08:00
fix: set page name for existing member, fix join workspace as guest parameter (#8)
This commit is contained in:
@@ -2045,12 +2045,14 @@ export async function getGuestInvitation (workspaceId: string, code: string) {
|
|||||||
return Promise.reject(response?.data);
|
return Promise.reject(response?.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function acceptGuestInvitation (workspaceId: string) {
|
export async function acceptGuestInvitation (workspaceId: string, code: string) {
|
||||||
const url = `/api/sharing/workspace/${workspaceId}/join-by-guest-invite-code`;
|
const url = `/api/sharing/workspace/${workspaceId}/join-by-guest-invite-code`;
|
||||||
const response = await axiosInstance?.post<{
|
const response = await axiosInstance?.post<{
|
||||||
code: number;
|
code: number;
|
||||||
message: string;
|
message: string;
|
||||||
}>(url);
|
}>(url, {
|
||||||
|
code,
|
||||||
|
});
|
||||||
|
|
||||||
if (response?.data.code === 0) {
|
if (response?.data.code === 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -696,8 +696,8 @@ export class AFClientService implements AFService {
|
|||||||
return APIService.getGuestInvitation(workspaceId, code);
|
return APIService.getGuestInvitation(workspaceId, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
async acceptGuestInvitation (workspaceId: string) {
|
async acceptGuestInvitation (workspaceId: string, code: string) {
|
||||||
return APIService.acceptGuestInvitation(workspaceId);
|
return APIService.acceptGuestInvitation(workspaceId, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGuestToMemberConversionInfo (workspaceId: string, code: string) {
|
async getGuestToMemberConversionInfo (workspaceId: string, code: string) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export interface WorkspaceService {
|
|||||||
inviteMembers: (workspaceId: string, emails: string[]) => Promise<void>;
|
inviteMembers: (workspaceId: string, emails: string[]) => Promise<void>;
|
||||||
searchWorkspace: (workspaceId: string, searchTerm: string) => Promise<string[]>;
|
searchWorkspace: (workspaceId: string, searchTerm: string) => Promise<string[]>;
|
||||||
getGuestInvitation: (workspaceId: string, code: string) => Promise<GuestInvitation>;
|
getGuestInvitation: (workspaceId: string, code: string) => Promise<GuestInvitation>;
|
||||||
acceptGuestInvitation: (workspaceId: string) => Promise<void>;
|
acceptGuestInvitation: (workspaceId: string, code: string) => Promise<void>;
|
||||||
getGuestToMemberConversionInfo: (workspaceId: string, code: string) => Promise<GuestConversionCodeInfo>;
|
getGuestToMemberConversionInfo: (workspaceId: string, code: string) => Promise<GuestConversionCodeInfo>;
|
||||||
approveTurnGuestToMember: (workspaceId: string, code: string) => Promise<void>;
|
approveTurnGuestToMember: (workspaceId: string, code: string) => Promise<void>;
|
||||||
}
|
}
|
||||||
@@ -217,4 +217,4 @@ export interface AIChatService {
|
|||||||
chatId: string,
|
chatId: string,
|
||||||
limit?: number | undefined,
|
limit?: number | undefined,
|
||||||
) => Promise<RepeatedChatMessage>;
|
) => Promise<RepeatedChatMessage>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,10 +41,6 @@ export function AsGuest() {
|
|||||||
try {
|
try {
|
||||||
const info = await service.getGuestInvitation(workspaceId, code);
|
const info = await service.getGuestInvitation(workspaceId, code);
|
||||||
|
|
||||||
if (info.is_existing_member) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setWorkspace({
|
setWorkspace({
|
||||||
id: info.workspace_id,
|
id: info.workspace_id,
|
||||||
name: info.workspace_name,
|
name: info.workspace_name,
|
||||||
@@ -59,7 +55,11 @@ export function AsGuest() {
|
|||||||
name: info.page_name,
|
name: info.page_name,
|
||||||
});
|
});
|
||||||
|
|
||||||
await service.acceptGuestInvitation(workspaceId);
|
if (info.is_existing_member) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await service.acceptGuestInvitation(workspaceId, code);
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user