Skip to content

Commit bf185d4

Browse files
authored
fix: set page name for existing member, fix join workspace as guest parameter (AppFlowy-IO#8)
1 parent 9777847 commit bf185d4

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/application/services/js-services/http/http_api.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,12 +2045,14 @@ export async function getGuestInvitation (workspaceId: string, code: string) {
20452045
return Promise.reject(response?.data);
20462046
}
20472047

2048-
export async function acceptGuestInvitation (workspaceId: string) {
2048+
export async function acceptGuestInvitation (workspaceId: string, code: string) {
20492049
const url = `/api/sharing/workspace/${workspaceId}/join-by-guest-invite-code`;
20502050
const response = await axiosInstance?.post<{
20512051
code: number;
20522052
message: string;
2053-
}>(url);
2053+
}>(url, {
2054+
code,
2055+
});
20542056

20552057
if (response?.data.code === 0) {
20562058
return;

src/application/services/js-services/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,8 @@ export class AFClientService implements AFService {
696696
return APIService.getGuestInvitation(workspaceId, code);
697697
}
698698

699-
async acceptGuestInvitation (workspaceId: string) {
700-
return APIService.acceptGuestInvitation(workspaceId);
699+
async acceptGuestInvitation (workspaceId: string, code: string) {
700+
return APIService.acceptGuestInvitation(workspaceId, code);
701701
}
702702

703703
async getGuestToMemberConversionInfo (workspaceId: string, code: string) {

src/application/services/services.type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export interface WorkspaceService {
7676
inviteMembers: (workspaceId: string, emails: string[]) => Promise<void>;
7777
searchWorkspace: (workspaceId: string, searchTerm: string) => Promise<string[]>;
7878
getGuestInvitation: (workspaceId: string, code: string) => Promise<GuestInvitation>;
79-
acceptGuestInvitation: (workspaceId: string) => Promise<void>;
79+
acceptGuestInvitation: (workspaceId: string, code: string) => Promise<void>;
8080
getGuestToMemberConversionInfo: (workspaceId: string, code: string) => Promise<GuestConversionCodeInfo>;
8181
approveTurnGuestToMember: (workspaceId: string, code: string) => Promise<void>;
8282
}
@@ -217,4 +217,4 @@ export interface AIChatService {
217217
chatId: string,
218218
limit?: number | undefined,
219219
) => Promise<RepeatedChatMessage>;
220-
}
220+
}

src/components/app/landing-pages/AsGuest.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ export function AsGuest() {
4141
try {
4242
const info = await service.getGuestInvitation(workspaceId, code);
4343

44-
if (info.is_existing_member) {
45-
return;
46-
}
47-
4844
setWorkspace({
4945
id: info.workspace_id,
5046
name: info.workspace_name,
@@ -59,7 +55,11 @@ export function AsGuest() {
5955
name: info.page_name,
6056
});
6157

62-
await service.acceptGuestInvitation(workspaceId);
58+
if (info.is_existing_member) {
59+
return;
60+
}
61+
62+
await service.acceptGuestInvitation(workspaceId, code);
6363

6464
// eslint-disable-next-line
6565
} catch (e: any) {

0 commit comments

Comments
 (0)