pl-fe: fix signup on Pleroma?
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -1297,6 +1297,10 @@ class PlApiClient {
|
||||
body: { language: params.locale, birthday: params.date_of_birth, ...params },
|
||||
});
|
||||
|
||||
if ('identifier' in response.json) return v.parse(v.object({
|
||||
message: v.string(),
|
||||
identifier: v.string(),
|
||||
}), response.json);
|
||||
return v.parse(tokenSchema, response.json);
|
||||
},
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pl-api",
|
||||
"version": "1.0.0-rc.81",
|
||||
"version": "1.0.0-rc.82",
|
||||
"type": "module",
|
||||
"homepage": "https://codeberg.org/mkljczk/pl-fe/src/branch/develop/packages/pl-api",
|
||||
"repository": {
|
||||
|
||||
@ -34,8 +34,8 @@ const noOp = () => new Promise(f => f(undefined));
|
||||
|
||||
const createAccount = (params: CreateAccountParams) =>
|
||||
async (dispatch: AppDispatch, getState: () => RootState) =>
|
||||
getClient(getState()).settings.createAccount(params).then((token) =>
|
||||
({ params, token }),
|
||||
getClient(getState()).settings.createAccount(params).then((response) =>
|
||||
({ params, response }),
|
||||
);
|
||||
|
||||
const fetchAccount = (accountId: string) =>
|
||||
|
||||
@ -302,9 +302,13 @@ const register = (params: CreateAccountParams) =>
|
||||
const { app } = await dispatch(createAppAndToken());
|
||||
|
||||
return dispatch(createAccount(params))
|
||||
.then(({ token }: { token: Token }) => {
|
||||
dispatch(startOnboarding());
|
||||
return dispatch(authLoggedIn(token, app));
|
||||
.then(({ response }) => {
|
||||
if ('identifier' in response) {
|
||||
toast.info(response.message);
|
||||
} else {
|
||||
dispatch(startOnboarding());
|
||||
return dispatch(authLoggedIn(response, app));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user