fix(client): shit apiVersion everywhere
Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit was merged in pull request #10.
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
|||||||
} from '@/components/ui/field';
|
} from '@/components/ui/field';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { useGetMagicLink } from '@/hooks/data/useGetMagicLink';
|
import { useGetMagicLink } from '@/hooks/data/useGetMagicLink';
|
||||||
|
import { ver } from '@/lib/apiVersion';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
export function LoginForm({
|
export function LoginForm({
|
||||||
@@ -32,7 +33,7 @@ export function LoginForm({
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const formData = new FormData(formRef.current!);
|
const formData = new FormData(formRef.current!);
|
||||||
const email = formData.get('email')! as string;
|
const email = formData.get('email')! as string;
|
||||||
mutateAsync({ body: { email, turnstile_token: token!, ...oauthParams } }).then(() => {
|
mutateAsync({ body: { email, turnstile_token: token!, ...oauthParams }, headers: ver('20260205') }).then(() => {
|
||||||
void navigate({ to: '/magicLinkSent', search: { email } });
|
void navigate({ to: '/magicLinkSent', search: { email } });
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { ServiceUserUserInfoData } from '@/client';
|
import type { ServiceUserUserInfoData } from '@/client';
|
||||||
import { useUpdateUser } from '@/hooks/data/useUpdateUser';
|
import { useUpdateUser } from '@/hooks/data/useUpdateUser';
|
||||||
|
import { ver } from '@/lib/apiVersion';
|
||||||
import { EditProfileDialogView } from './edit-profile.dialog.view';
|
import { EditProfileDialogView } from './edit-profile.dialog.view';
|
||||||
|
|
||||||
export function EditProfileDialogContainer({ data }: { data: ServiceUserUserInfoData }) {
|
export function EditProfileDialogContainer({ data }: { data: ServiceUserUserInfoData }) {
|
||||||
@@ -8,7 +9,7 @@ export function EditProfileDialogContainer({ data }: { data: ServiceUserUserInfo
|
|||||||
<EditProfileDialogView
|
<EditProfileDialogView
|
||||||
user={data}
|
user={data}
|
||||||
updateProfile={async (data) => {
|
updateProfile={async (data) => {
|
||||||
await mutateAsync({ body: data });
|
await mutateAsync({ body: data, headers: ver('20260205') });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useUpdateUser } from '@/hooks/data/useUpdateUser';
|
import { useUpdateUser } from '@/hooks/data/useUpdateUser';
|
||||||
import { useOtherUserInfo } from '@/hooks/data/useUserInfo';
|
import { useOtherUserInfo } from '@/hooks/data/useUserInfo';
|
||||||
|
import { ver } from '@/lib/apiVersion';
|
||||||
import { utf8ToBase64 } from '@/lib/utils';
|
import { utf8ToBase64 } from '@/lib/utils';
|
||||||
import { ProfileView } from './profile.view';
|
import { ProfileView } from './profile.view';
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ export function ProfileContainer({ userId }: { userId: string }) {
|
|||||||
<ProfileView
|
<ProfileView
|
||||||
user={data.data!}
|
user={data.data!}
|
||||||
onSaveBio={async (bio) => {
|
onSaveBio={async (bio) => {
|
||||||
await mutateAsync({ body: { bio: utf8ToBase64(bio) } });
|
await mutateAsync({ body: { bio: utf8ToBase64(bio) }, headers: ver('20260205') });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { ServiceAuthTokenResponse } from '@/client';
|
import type { ServiceAuthTokenResponse } from '@/client';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { postAuthRefresh } from '@/client';
|
import { postAuthRefresh } from '@/client';
|
||||||
|
import { ver } from './apiVersion';
|
||||||
import { router } from './router';
|
import { router } from './router';
|
||||||
|
|
||||||
const ACCESS_TOKEN_LOCALSTORAGE_KEY = 'token';
|
const ACCESS_TOKEN_LOCALSTORAGE_KEY = 'token';
|
||||||
@@ -40,6 +41,7 @@ export async function doRefreshToken(refreshToken: string): Promise<ServiceAuthT
|
|||||||
body: {
|
body: {
|
||||||
refresh_token: refreshToken,
|
refresh_token: refreshToken,
|
||||||
},
|
},
|
||||||
|
headers: ver('20260205'),
|
||||||
});
|
});
|
||||||
return data?.data;
|
return data?.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useEffect } from 'react';
|
|||||||
import z from 'zod';
|
import z from 'zod';
|
||||||
import { LoginForm } from '@/components/login-form';
|
import { LoginForm } from '@/components/login-form';
|
||||||
import { useExchangeToken } from '@/hooks/data/useExchangeToken';
|
import { useExchangeToken } from '@/hooks/data/useExchangeToken';
|
||||||
|
import { ver } from '@/lib/apiVersion';
|
||||||
import { generateOAuthState } from '@/lib/random';
|
import { generateOAuthState } from '@/lib/random';
|
||||||
import { getAccessToken } from '@/lib/token';
|
import { getAccessToken } from '@/lib/token';
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ function RouteComponent() {
|
|||||||
redirect_uri: oauthParams.redirect_uri,
|
redirect_uri: oauthParams.redirect_uri,
|
||||||
state: oauthParams.state,
|
state: oauthParams.state,
|
||||||
},
|
},
|
||||||
|
headers: ver('20260205'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [token, mutation.isIdle, mutation, oauthParams.client_id, oauthParams.redirect_uri, oauthParams.state]);
|
}, [token, mutation.isIdle, mutation, oauthParams.client_id, oauthParams.redirect_uri, oauthParams.state]);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import z from 'zod';
|
import z from 'zod';
|
||||||
import { postAuthTokenMutation } from '@/client/@tanstack/react-query.gen';
|
import { postAuthTokenMutation } from '@/client/@tanstack/react-query.gen';
|
||||||
|
import { ver } from '@/lib/apiVersion';
|
||||||
import { setAccessToken, setRefreshToken } from '@/lib/token';
|
import { setAccessToken, setRefreshToken } from '@/lib/token';
|
||||||
|
|
||||||
const tokenCodeSchema = z.object({
|
const tokenCodeSchema = z.object({
|
||||||
@@ -36,7 +37,7 @@ function RouteComponent() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (mutation.isIdle) {
|
if (mutation.isIdle) {
|
||||||
mutation.mutate({ body: { code } });
|
mutation.mutate({ body: { code }, headers: ver('20260205') });
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -23,29 +23,34 @@ type Story = StoryObj<typeof meta>;
|
|||||||
|
|
||||||
export const Prompt: Story = {
|
export const Prompt: Story = {
|
||||||
args: {
|
args: {
|
||||||
|
next: () => { },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MethodSelection: Story = {
|
export const MethodSelection: Story = {
|
||||||
render: () => <KycMethodSelectionDialogView onSubmit={async () => Promise.resolve()} />,
|
render: () => <KycMethodSelectionDialogView onSubmit={async () => Promise.resolve()} />,
|
||||||
args: {
|
args: {
|
||||||
|
next: () => { },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Pending: Story = {
|
export const Pending: Story = {
|
||||||
render: () => <KycPendingDialogView />,
|
render: () => <KycPendingDialogView />,
|
||||||
args: {
|
args: {
|
||||||
|
next: () => { },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Success: Story = {
|
export const Success: Story = {
|
||||||
render: () => <KycSuccessDialogView />,
|
render: () => <KycSuccessDialogView />,
|
||||||
args: {
|
args: {
|
||||||
|
next: () => { },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Failed: Story = {
|
export const Failed: Story = {
|
||||||
render: () => <KycFailedDialogView />,
|
render: () => <KycFailedDialogView />,
|
||||||
args: {
|
args: {
|
||||||
|
next: () => { },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user