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);
|
||||
}
|
||||
|
||||
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 response = await axiosInstance?.post<{
|
||||
code: number;
|
||||
message: string;
|
||||
}>(url);
|
||||
}>(url, {
|
||||
code,
|
||||
});
|
||||
|
||||
if (response?.data.code === 0) {
|
||||
return;
|
||||
|
||||
@@ -696,8 +696,8 @@ export class AFClientService implements AFService {
|
||||
return APIService.getGuestInvitation(workspaceId, code);
|
||||
}
|
||||
|
||||
async acceptGuestInvitation (workspaceId: string) {
|
||||
return APIService.acceptGuestInvitation(workspaceId);
|
||||
async acceptGuestInvitation (workspaceId: string, code: string) {
|
||||
return APIService.acceptGuestInvitation(workspaceId, code);
|
||||
}
|
||||
|
||||
async getGuestToMemberConversionInfo (workspaceId: string, code: string) {
|
||||
|
||||
@@ -76,7 +76,7 @@ export interface WorkspaceService {
|
||||
inviteMembers: (workspaceId: string, emails: string[]) => Promise<void>;
|
||||
searchWorkspace: (workspaceId: string, searchTerm: string) => Promise<string[]>;
|
||||
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>;
|
||||
approveTurnGuestToMember: (workspaceId: string, code: string) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -41,10 +41,6 @@ export function AsGuest() {
|
||||
try {
|
||||
const info = await service.getGuestInvitation(workspaceId, code);
|
||||
|
||||
if (info.is_existing_member) {
|
||||
return;
|
||||
}
|
||||
|
||||
setWorkspace({
|
||||
id: info.workspace_id,
|
||||
name: info.workspace_name,
|
||||
@@ -59,7 +55,11 @@ export function AsGuest() {
|
||||
name: info.page_name,
|
||||
});
|
||||
|
||||
await service.acceptGuestInvitation(workspaceId);
|
||||
if (info.is_existing_member) {
|
||||
return;
|
||||
}
|
||||
|
||||
await service.acceptGuestInvitation(workspaceId, code);
|
||||
|
||||
// eslint-disable-next-line
|
||||
} catch (e: any) {
|
||||
|
||||
Reference in New Issue
Block a user