feat: mewe
Some checks failed
Build Containers / build-containers-common (push) Has been cancelled
Build / build (22.12.0) (push) Has been cancelled
Build Containers / build-containers (amd64, ubuntu-latest) (push) Has been cancelled
Build Containers / build-containers (arm64, ubuntu-24.04-arm) (push) Has been cancelled
Build Containers / build-container-manifest (push) Has been cancelled
Some checks failed
Build Containers / build-containers-common (push) Has been cancelled
Build / build (22.12.0) (push) Has been cancelled
Build Containers / build-containers (amd64, ubuntu-latest) (push) Has been cancelled
Build Containers / build-containers (arm64, ubuntu-24.04-arm) (push) Has been cancelled
Build Containers / build-container-manifest (push) Has been cancelled
This commit is contained in:
parent
2ae98a925a
commit
cf2a980dd8
2 changed files with 14 additions and 18 deletions
|
|
@ -41,11 +41,7 @@ export const ContinueIntegration: FC<{
|
|||
|
||||
// Helper to handle navigation - redirects if logged or returnURL exists, otherwise shows inline
|
||||
const navigateOrShow = useCallback(
|
||||
(
|
||||
path: string,
|
||||
returnURL: string | undefined,
|
||||
successMessage: string
|
||||
) => {
|
||||
(path: string, returnURL: string | undefined, successMessage: string) => {
|
||||
if (returnURL) {
|
||||
// If returnURL exists, always redirect to it with the path params
|
||||
const params = path.includes('?') ? path.split('?')[1] : '';
|
||||
|
|
@ -61,6 +57,13 @@ export const ContinueIntegration: FC<{
|
|||
[logged, push]
|
||||
);
|
||||
const modifiedParams = useMemo(() => {
|
||||
if (provider === 'mewe') {
|
||||
return {
|
||||
state: searchParams.state || '',
|
||||
code: searchParams.loginRequestToken || '',
|
||||
refresh: searchParams.refresh || '',
|
||||
};
|
||||
}
|
||||
if (provider === 'x') {
|
||||
return {
|
||||
state: searchParams.oauth_token || '',
|
||||
|
|
@ -79,9 +82,7 @@ export const ContinueIntegration: FC<{
|
|||
|
||||
if (provider === 'mewe') {
|
||||
const hash =
|
||||
typeof window !== 'undefined'
|
||||
? window.location.hash.substring(1)
|
||||
: '';
|
||||
typeof window !== 'undefined' ? window.location.hash.substring(1) : '';
|
||||
const hashParams = new URLSearchParams(hash);
|
||||
return {
|
||||
state: hashParams.get('state') || searchParams.state || '',
|
||||
|
|
@ -139,7 +140,9 @@ export const ContinueIntegration: FC<{
|
|||
data.status !== HttpStatusCode.Created
|
||||
) {
|
||||
const errorData = await data.json().catch(() => ({}));
|
||||
setErrorMessage(errorData.message || errorData.msg || 'Could not add provider');
|
||||
setErrorMessage(
|
||||
errorData.message || errorData.msg || 'Could not add provider'
|
||||
);
|
||||
setError(true);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,7 +272,6 @@ export class MeweProvider extends SocialAbstract implements SocialProvider {
|
|||
|
||||
if (!postResponse.ok) {
|
||||
const errorText = await postResponse.text();
|
||||
console.log(errorText);
|
||||
const handleError = this.handleErrors(errorText);
|
||||
if (handleError) {
|
||||
throw new Error(handleError.value);
|
||||
|
|
@ -280,15 +279,9 @@ export class MeweProvider extends SocialAbstract implements SocialProvider {
|
|||
throw new Error('Failed to create MeWe post');
|
||||
}
|
||||
|
||||
let postId = '';
|
||||
try {
|
||||
const responseData = await postResponse.json();
|
||||
postId = responseData.postId || responseData.id || makeId(12);
|
||||
} catch {
|
||||
postId = makeId(12);
|
||||
}
|
||||
const postId = makeId(12);
|
||||
|
||||
const releaseURL = `${this.meweHost}/post/show/${postId}`;
|
||||
const releaseURL = postType === 'timeline' ? `https://mewe.com/${integration.profile}/posts` : `https://mewe.com/group/${firstPost.settings.group}`;
|
||||
|
||||
return [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue