fix: set page name for existing member, fix join workspace as guest parameter (#8)

This commit is contained in:
Khor Shu Heng
2025-06-23 17:33:26 +08:00
committed by GitHub
parent 2cc7415962
commit 5418485b88
4 changed files with 13 additions and 11 deletions

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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>;
} }

View File

@@ -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) {