am i finished?
This commit is contained in:
@@ -55,7 +55,7 @@ export const sendImageFile = async (
|
||||
file: File,
|
||||
): Promise<InferOutput<typeof sendImageResponseValidator>> => {
|
||||
const request = getBaseAuthorizedRequest({
|
||||
path: `image/${imageName}`,
|
||||
path: `images/${imageName}`,
|
||||
body: file,
|
||||
method: "POST",
|
||||
});
|
||||
@@ -72,7 +72,7 @@ export const sendImage = async (
|
||||
base64Image: string,
|
||||
): Promise<InferOutput<typeof sendImageResponseValidator>> => {
|
||||
const request = getBaseAuthorizedRequest({
|
||||
path: `image/${imageName}`,
|
||||
path: `images/${imageName}`,
|
||||
body: base64Image,
|
||||
method: "POST",
|
||||
});
|
||||
@@ -161,9 +161,9 @@ const listValidator = strictObject({
|
||||
export type List = InferOutput<typeof listValidator>;
|
||||
|
||||
const imageRequestValidator = strictObject({
|
||||
UserImages: array(userImageValidator),
|
||||
ProcessingImages: array(userProcessingImageValidator),
|
||||
Lists: array(listValidator),
|
||||
userImages: array(userImageValidator),
|
||||
processingImages: array(userProcessingImageValidator),
|
||||
lists: array(listValidator),
|
||||
});
|
||||
|
||||
export type JustTheImageWhatAreTheseNames = InferOutput<
|
||||
@@ -173,18 +173,16 @@ export type JustTheImageWhatAreTheseNames = InferOutput<
|
||||
export const getUserImages = async (): Promise<
|
||||
InferOutput<typeof imageRequestValidator>
|
||||
> => {
|
||||
const request = getBaseAuthorizedRequest({ path: "image" });
|
||||
const request = getBaseAuthorizedRequest({ path: "images" });
|
||||
|
||||
const res = await fetch(request).then((res) => res.json());
|
||||
|
||||
console.log("BACKEND RESPONSE: ", res);
|
||||
|
||||
return parse(imageRequestValidator, res);
|
||||
};
|
||||
|
||||
export const postLogin = async (email: string): Promise<void> => {
|
||||
const request = getBaseRequest({
|
||||
path: "login",
|
||||
path: "auth/login",
|
||||
body: JSON.stringify({ email }),
|
||||
method: "POST",
|
||||
});
|
||||
@@ -192,18 +190,6 @@ export const postLogin = async (email: string): Promise<void> => {
|
||||
await fetch(request);
|
||||
};
|
||||
|
||||
export const postDemoLogin = async (): Promise<
|
||||
InferOutput<typeof codeValidator>
|
||||
> => {
|
||||
const request = getBaseRequest({
|
||||
path: "demo-login",
|
||||
});
|
||||
|
||||
const res = await fetch(request).then((res) => res.json());
|
||||
|
||||
return parse(codeValidator, res);
|
||||
};
|
||||
|
||||
const codeValidator = strictObject({
|
||||
access: string(),
|
||||
refresh: string(),
|
||||
@@ -214,7 +200,7 @@ export const postCode = async (
|
||||
code: string,
|
||||
): Promise<InferOutput<typeof codeValidator>> => {
|
||||
const request = getBaseRequest({
|
||||
path: "code",
|
||||
path: "auth/code",
|
||||
body: JSON.stringify({ email, code }),
|
||||
method: "POST",
|
||||
});
|
||||
@@ -223,3 +209,18 @@ export const postCode = async (
|
||||
|
||||
return parse(codeValidator, res);
|
||||
};
|
||||
|
||||
export const createList = async (
|
||||
title: string,
|
||||
description: string,
|
||||
): Promise<void> => {
|
||||
const request = getBaseAuthorizedRequest({
|
||||
path: "stacks",
|
||||
method: "POST",
|
||||
body: JSON.stringify({ title, description }),
|
||||
});
|
||||
|
||||
request.headers.set("Content-Type", "application/json");
|
||||
|
||||
await fetch(request);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user