Skip to content

Commit

Permalink
Merge branch 'main' into db-error-wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
ravisuhag authored Dec 16, 2024
2 parents 730e647 + 061fe94 commit 3bbaed9
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 102 deletions.
6 changes: 3 additions & 3 deletions examples/authn/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ require (
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 6 additions & 6 deletions examples/authn/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZ
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const projectSchema = yup
/^[a-zA-Z0-9_-]{3,50}$/,
"Only numbers, letters, '-', and '_' are allowed. Spaces are not allowed."
),
orgId: yup.string().required()
org_id: yup.string().required()
})
.required();

Expand All @@ -42,6 +42,7 @@ export const AddProject = () => {
reset,
control,
handleSubmit,
setError,
formState: { errors, isSubmitting }
} = useForm({
resolver: yupResolver(projectSchema)
Expand All @@ -50,7 +51,7 @@ export const AddProject = () => {
const { client, activeOrganization: organization } = useFrontier();

useEffect(() => {
reset({ orgId: organization?.id });
reset({ org_id: organization?.id });
}, [organization, reset]);

async function onSubmit(data: FormData) {
Expand All @@ -60,10 +61,16 @@ export const AddProject = () => {
await client.frontierServiceCreateProject(data);
toast.success('Project added');
navigate({ to: '/projects' });
} catch ({ error }: any) {
toast.error('Something went wrong', {
description: error.message
});
} catch (err: unknown) {
if (err instanceof Response && err?.status === 409) {
setError('name', {
message: 'Project name already exist, please enter unique name'
});
} else {
toast.error('Something went wrong', {
description: (err as Error)?.message
});
}
}
}

Expand All @@ -83,6 +90,7 @@ export const AddProject = () => {
// @ts-ignore
src={cross}
onClick={() => navigate({ to: '/projects' })}
data-test-id="frontier-sdk-new-project-close-btn"
style={{ cursor: 'pointer' }}
/>
</Flex>
Expand Down
4 changes: 2 additions & 2 deletions sdks/js/packages/sdk-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"lint": "next lint"
},
"dependencies": {
"@raystack/apsara": "^0.20.4",
"@raystack/frontier": "^0.32.3",
"@raystack/apsara": "^0.26.2",
"@raystack/frontier": "^0.40.0",
"next": "14.2.5",
"next-http-proxy-middleware": "^1.2.6",
"react": "^18",
Expand Down
90 changes: 16 additions & 74 deletions sdks/js/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3bbaed9

Please sign in to comment.