Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client): upload images client flow with s3 presigned #67

Open
wants to merge 8 commits into
base: anmho/fix-api-dev-server
Choose a base branch
from

Conversation

anmho
Copy link
Collaborator

@anmho anmho commented Dec 9, 2024

Implemented client using React-Query.
Used a Promise.all approach and displayed upload state to the user.
Updated http method to from GET to POST for /create-upload-url

@anmho anmho changed the base branch from main to anmho/fix-api-dev-server December 9, 2024 04:12
@anmho anmho requested a review from Jish2 December 9, 2024 04:12
@@ -31,6 +31,6 @@ watch:
# Generates the client SDK from the server's current OpenAPI spec.
gen:
@$(MAKE) -C api openapi
@orval --input ./api/openapi.yaml --output ./client-v2/gen/openapi.ts
@orval --input ./api/openapi.yaml --output ./client-v2/lib/api/happened.ts
Copy link
Collaborator Author

@anmho anmho Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to a lib/api folder for to improve semantics.

@@ -109,12 +109,13 @@ func main() {
}
logger.Info("successfully pinged db")

cfg, err := awsConfig.LoadDefaultConfig(ctx)
cfg, err := awsConfig.LoadDefaultConfig(ctx, awsConfig.WithRegion("us-west-2"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force us-west-2 but this should be an environment variable.

@@ -94,6 +96,6 @@ func registerRoutes(
},
}, protectedGreetHandler())

huma.Get(api, "/create-upload-url", CreateUploadURLHandler(imageService))
huma.Post(api, "/create-upload-url", CreateUploadURLHandler(imageService))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post since we are created a presigned upload url resource.

@@ -63,7 +63,7 @@ export default function Page() {

if (completeSignIn.status === "complete") {
await setActive({ session: completeSignIn.createdSessionId });
router.replace("/(home)");
router.replace("/(tabs)");
Copy link
Collaborator Author

@anmho anmho Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigate to tabs layout as the home.

// Queries
const { isPending: isUploadPending, mutateAsync: uploadImagesMutation } =
useMutation({
mutationFn: uploadImages,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upload/create journey tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant