mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
Merge pull request #136 from nvrthles/dev
NextJS client side sign up URL not including using organization
This commit is contained in:
commit
01e6d6d171
3 changed files with 8 additions and 2 deletions
2
apps/api/.gitignore
vendored
2
apps/api/.gitignore
vendored
|
|
@ -162,7 +162,7 @@ dmypy.json
|
|||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
.idea/
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ function SignUpClient(props: SignUpClientProps) {
|
|||
const formik = useFormik({
|
||||
initialValues: {
|
||||
org_slug: props.org?.slug,
|
||||
org_id: props.org?.id,
|
||||
email: '',
|
||||
password: '',
|
||||
username: '',
|
||||
|
|
@ -70,6 +71,8 @@ function SignUpClient(props: SignUpClientProps) {
|
|||
},
|
||||
validate,
|
||||
onSubmit: async values => {
|
||||
setError('')
|
||||
setMessage('')
|
||||
setIsSubmitting(true);
|
||||
let res = await signup(values);
|
||||
let message = await res.json();
|
||||
|
|
@ -81,6 +84,7 @@ function SignUpClient(props: SignUpClientProps) {
|
|||
else if (res.status == 401 || res.status == 400 || res.status == 404 || res.status == 409) {
|
||||
setError(message.detail);
|
||||
setIsSubmitting(false);
|
||||
|
||||
}
|
||||
else {
|
||||
setError("Something went wrong");
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ interface NewAccountBody {
|
|||
email: string;
|
||||
password: string;
|
||||
org_slug: string;
|
||||
org_id:string;
|
||||
}
|
||||
|
||||
export async function signup(body: NewAccountBody): Promise<any> {
|
||||
|
|
@ -134,6 +135,7 @@ export async function signup(body: NewAccountBody): Promise<any> {
|
|||
redirect: "follow",
|
||||
};
|
||||
|
||||
const res = await fetch(`${getAPIUrl()}users/?org_slug=${body.org_slug}`, requestOptions);
|
||||
const res = await fetch(`${getAPIUrl()}users/${body.org_id}`, requestOptions);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue