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: removing all backend integration #72

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/frontend/components/Layout/PortalNavigationDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
></v-list-item>
</NuxtLink>

<NuxtLink to="/conversations">
<NuxtLink to="#">
<v-list-item
class="my-3"
prepend-icon="mdi-forum"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
Thanks for joining! 🎉
</div>
<div class="font-14 text-black mt-4 text-center">
We are in the process of setting up your dedicated hotline. While it typically takes a few business
days, rest assured you'll be notified via email once your number is primed for use.
We're setting things up on our end.
<br>
<br>
<i>
Note: Your trial will commence only after the setup is finalized.
</i>
Thanks for showing interest 😃
<!-- <br>-->
<!-- <i>-->
<!-- Note: Your trial will commence only after the setup is finalized.-->
<!-- </i>-->
</div>

<v-btn
Expand Down
44 changes: 24 additions & 20 deletions src/frontend/composables/useRequest.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import {MaybeRef} from '@vueuse/core';

export const useRequest = <T = any>(url: MaybeRef<string>, opts?: Omit<RequestInit, 'body'> & { body?: any }) => {
const config = useRuntimeConfig();
const csrfToken = useCookie('csrftoken');
const headers = {
'X-CSRFToken': csrfToken.value || '',
'Content-Type': 'application/json', // Maybe dont' want this here? TODO
...opts?.headers,
};
const method = (opts?.method?.toUpperCase() || 'GET') as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS';

const body = opts?.body ? JSON.stringify(opts.body) : undefined;

return useFetch<T>(url, {
baseURL: `${config.public.server_url}`,
credentials: 'include',
headers,
// @ts-ignore
method,
body,
...opts,
});
// const config = useRuntimeConfig();
// const csrfToken = useCookie('csrftoken');
// const headers = {
// 'X-CSRFToken': csrfToken.value || '',
// 'Content-Type': 'application/json', // Maybe dont' want this here? TODO
// ...opts?.headers,
// };
// const method = (opts?.method?.toUpperCase() || 'GET') as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS';
//
// const body = opts?.body ? JSON.stringify(opts.body) : undefined;
//
// return useFetch<T>(url, {
// baseURL: `${config.public.server_url}`,
// credentials: 'include',
// headers,
// // @ts-ignore
// method,
// body,
// ...opts,
// });
// return an empty promise
return new Promise<T>((resolve, reject) => {
resolve({} as T);
})
};
11 changes: 5 additions & 6 deletions src/frontend/layouts/protected.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
</template>
</ScreenSwitcher>
<v-main style="min-height: 100vh">
<SubscriptionDialog
:model-value="showSubscriptionDialog"
@input="showSubscriptionDialog=$event"
/>
<!-- <SubscriptionDialog-->
<!-- :model-value="showSubscriptionDialog"-->
<!-- @input="showSubscriptionDialog=$event"-->
<!-- />-->
<RegisteringNumberDialog
:model-value="showRegisteringDialog"
@input="showRegisteringDialog=$event"
Expand All @@ -27,7 +27,6 @@
import {useThemeSwitcher} from "~/composables/useThemeSwitcher";
import {useUserStore} from "~/store/userStore";
import {useRoute} from "vue-router";
import SubscriptionDialog from "~/components/SubscriptionDialog/SubscriptionDialog.vue";
import PortalNavigationDrawer from "~/components/Layout/PortalNavigationDrawer.vue";
import ScreenSwitcher from "~/components/ScreenSwitcher/ScreenSwitcher.vue";
import PortalMobileHeader from "~/components/Layout/PortalMobileHeader.vue";
Expand All @@ -38,7 +37,7 @@ const route = useRoute()

useThemeSwitcher()
const showSubscriptionDialog = ref(false)
const showRegisteringDialog = ref(false)
const showRegisteringDialog = ref(true)

watch(() => route.path, () => {
handleSubscriptionCheck()
Expand Down
48 changes: 24 additions & 24 deletions src/frontend/middleware/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ import {useUserStore} from "~/store/userStore";
import {useSnackbarStore} from "~/store/snackbarStore";

export default defineNuxtRouteMiddleware(async (_to, _from) => {
const csrftoken = useCookie('csrftoken')
if (!csrftoken.value) {
csrftoken.value = null
return navigateTo('/')
}
if (process.client) {
const auth = useUserStore()

if (!auth.authUser || !auth.isLoggedIn) {
// await auth.fetchUser()

return navigateTo('/')
} else if (_from.path === '/signup/company-info' && _to.path === '/dashboard' && !auth.authUser.company) {
// allows user to go back from signing up
// await auth.logout()
return navigateTo('/')
} else if (
auth.authUser && !auth.authUser.company && _to.path !== '/signup/company-info' && _from.path !== '/signup/company-info'
) {
const snackbar = useSnackbarStore()
snackbar.displaySnackbar('highlight', "Please provide a company first.")
return navigateTo('/signup/company-info')
}
}
// const csrftoken = useCookie('csrftoken')
// if (!csrftoken.value) {
// csrftoken.value = null
// return navigateTo('/')
// }
// if (process.client) {
// const auth = useUserStore()
//
// if (!auth.authUser || !auth.isLoggedIn) {
// // await auth.fetchUser()
//
// return navigateTo('/')
// } else if (_from.path === '/signup/company-info' && _to.path === '/dashboard' && !auth.authUser.company) {
// // allows user to go back from signing up
// // await auth.logout()
// return navigateTo('/')
// } else if (
// auth.authUser && !auth.authUser.company && _to.path !== '/signup/company-info' && _from.path !== '/signup/company-info'
// ) {
// const snackbar = useSnackbarStore()
// snackbar.displaySnackbar('highlight', "Please provide a company first.")
// return navigateTo('/signup/company-info')
// }
// }
})
14 changes: 7 additions & 7 deletions src/frontend/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ const url = "https://propconnect.io";
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
// Runtime Config
runtimeConfig: {
public: {
server_url: process.env.API_BASE_URL || 'http://localhost:8000/api',
DEFAULT_TWILIO_NUMBER: process.env.DEFAULT_TWILIO_NUMBER,
STRIPE_PUBLISHABLE_KEY: process.env.STRIPE_PUBLISHABLE_KEY,
},
},
// runtimeConfig: {
// public: {
// server_url: process.env.API_BASE_URL || 'http://localhost:8000/api',
// DEFAULT_TWILIO_NUMBER: process.env.DEFAULT_TWILIO_NUMBER,
// STRIPE_PUBLISHABLE_KEY: process.env.STRIPE_PUBLISHABLE_KEY,
// },
// },

// import styles
css: ["@/assets/main.scss", "@/assets/stylus/index.styl"],
Expand Down
24 changes: 0 additions & 24 deletions src/frontend/pages/conversations/[id].vue

This file was deleted.

20 changes: 0 additions & 20 deletions src/frontend/pages/conversations/index.vue

This file was deleted.

2 changes: 1 addition & 1 deletion src/frontend/pages/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useDisplay } from 'vuetify'
import Dashboard from "../sections/portal/dashboard/Dashboard"

definePageMeta({
middleware: ["auth"],
// middleware: ["auth"],
layout: 'protected'
})

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/pages/signup/company-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import CompanyInformation from "~/sections/company-signup/CompanyInformation.vue";

definePageMeta({
middleware: ["auth"],
// middleware: ["auth"],
layout: "signup",
})

Expand Down
22 changes: 0 additions & 22 deletions src/frontend/pages/vendor-onboarding/[token].vue

This file was deleted.

Loading