fix: invite links
This commit is contained in:
@@ -93,7 +93,10 @@ export const channelApi = createApi({
|
||||
}),
|
||||
transformResponse: (link: string) => {
|
||||
// 确保http开头
|
||||
return link.startsWith("http") ? link : `http://${link}`;
|
||||
const _link = link.startsWith("http") ? link : `http://${link}`;
|
||||
// 替换掉域名
|
||||
const invite = new URL(_link);
|
||||
return `${location.origin}${invite.pathname}${invite.search}${invite.hash}`;
|
||||
}
|
||||
}),
|
||||
removeChannel: builder.query<void, number>({
|
||||
|
||||
@@ -162,8 +162,10 @@ export const serverApi = createApi({
|
||||
responseHandler: (response: Response) => response.text()
|
||||
}),
|
||||
transformResponse: (link: string) => {
|
||||
// 确保http开头
|
||||
const _link = link.startsWith("http") ? link : `http://${link}`;
|
||||
// 替换掉域名
|
||||
const invite = new URL(link);
|
||||
const invite = new URL(_link);
|
||||
return `${location.origin}${invite.pathname}${invite.search}${invite.hash}`;
|
||||
}
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user