mirror of https://github.com/buster-so/buster.git
Merge pull request #316 from buster-so/Payment-required-bug-fix
Payment required bug fix
This commit is contained in:
commit
97228e29f6
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "buster_server"
|
name = "buster_server"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
default-run = "buster_server"
|
default-run = "buster_server"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "buster-cli"
|
name = "buster-cli"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"api_tag": "api/v0.1.6", "api_version": "0.1.6"
|
"api_tag": "api/v0.1.7", "api_version": "0.1.7"
|
||||||
,
|
,
|
||||||
"web_tag": "web/v0.1.6", "web_version": "0.1.6"
|
"web_tag": "web/v0.1.7", "web_version": "0.1.7"
|
||||||
,
|
,
|
||||||
"cli_tag": "cli/v0.1.6", "cli_version": "0.1.6"
|
"cli_tag": "cli/v0.1.7", "cli_version": "0.1.7"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "web",
|
"name": "web",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "web",
|
"name": "web",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@dnd-kit/modifiers": "^9.0.0",
|
"@dnd-kit/modifiers": "^9.0.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "web",
|
"name": "web",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbo",
|
"dev": "next dev --turbo",
|
||||||
|
|
|
@ -123,12 +123,14 @@ export const useCreateUserOrganization = () => {
|
||||||
const onCreateUserOrganization = useMemoizedFn(
|
const onCreateUserOrganization = useMemoizedFn(
|
||||||
async ({ name, company }: { name: string; company: string }) => {
|
async ({ name, company }: { name: string; company: string }) => {
|
||||||
const alreadyHasOrganization = !!userResponse?.organizations?.[0];
|
const alreadyHasOrganization = !!userResponse?.organizations?.[0];
|
||||||
if (userResponse)
|
if (!alreadyHasOrganization) await createOrganization({ name: company });
|
||||||
|
if (userResponse) {
|
||||||
await updateUserInfo({
|
await updateUserInfo({
|
||||||
userId: userResponse.user.id,
|
userId: userResponse.user.id,
|
||||||
name
|
name
|
||||||
});
|
});
|
||||||
if (!alreadyHasOrganization) await createOrganization({ name: company });
|
await refetchUserResponse();
|
||||||
|
}
|
||||||
await refetchUserResponse();
|
await refetchUserResponse();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { AxiosRequestHeaders } from 'axios';
|
||||||
import { isServer } from '@tanstack/react-query';
|
import { isServer } from '@tanstack/react-query';
|
||||||
import { getSupabaseTokenFromCookies } from './createServerInstance';
|
import { getSupabaseTokenFromCookies } from './createServerInstance';
|
||||||
import { SupabaseContextReturnType } from '@/context/Supabase/SupabaseContextProvider';
|
import { SupabaseContextReturnType } from '@/context/Supabase/SupabaseContextProvider';
|
||||||
|
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||||
|
|
||||||
const AXIOS_TIMEOUT = 120000; // 2 minutes
|
const AXIOS_TIMEOUT = 120000; // 2 minutes
|
||||||
|
|
||||||
|
@ -21,6 +22,14 @@ export const createInstance = (baseURL: string) => {
|
||||||
return resp;
|
return resp;
|
||||||
},
|
},
|
||||||
(error: AxiosError) => {
|
(error: AxiosError) => {
|
||||||
|
const errorCode = error.response?.status;
|
||||||
|
//402 is the payment required error code
|
||||||
|
if (errorCode === 402) {
|
||||||
|
window.location.href = createBusterRoute({
|
||||||
|
route: BusterRoutes.INFO_GETTING_STARTED
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.reject(rustErrorHandler(error));
|
return Promise.reject(rustErrorHandler(error));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue