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 symbols
|
||||||
cython_debug/
|
cython_debug/
|
||||||
|
.idea/
|
||||||
# PyCharm
|
# PyCharm
|
||||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
# 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
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ function SignUpClient(props: SignUpClientProps) {
|
||||||
const formik = useFormik({
|
const formik = useFormik({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
org_slug: props.org?.slug,
|
org_slug: props.org?.slug,
|
||||||
|
org_id: props.org?.id,
|
||||||
email: '',
|
email: '',
|
||||||
password: '',
|
password: '',
|
||||||
username: '',
|
username: '',
|
||||||
|
|
@ -70,6 +71,8 @@ function SignUpClient(props: SignUpClientProps) {
|
||||||
},
|
},
|
||||||
validate,
|
validate,
|
||||||
onSubmit: async values => {
|
onSubmit: async values => {
|
||||||
|
setError('')
|
||||||
|
setMessage('')
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
let res = await signup(values);
|
let res = await signup(values);
|
||||||
let message = await res.json();
|
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) {
|
else if (res.status == 401 || res.status == 400 || res.status == 404 || res.status == 409) {
|
||||||
setError(message.detail);
|
setError(message.detail);
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setError("Something went wrong");
|
setError("Something went wrong");
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ interface NewAccountBody {
|
||||||
email: string;
|
email: string;
|
||||||
password: string;
|
password: string;
|
||||||
org_slug: string;
|
org_slug: string;
|
||||||
|
org_id:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function signup(body: NewAccountBody): Promise<any> {
|
export async function signup(body: NewAccountBody): Promise<any> {
|
||||||
|
|
@ -134,6 +135,7 @@ export async function signup(body: NewAccountBody): Promise<any> {
|
||||||
redirect: "follow",
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue