Skip to content

Commit

Permalink
fix(client): Logout was not always working properly (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayllyz authored Jul 16, 2024
1 parent 3d90f5f commit 7bd7b31
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
4 changes: 3 additions & 1 deletion apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import { polls } from './handlers/votes.js';

const app = new OpenAPIHono();

app.use('*', logger());
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'development') {
app.use('*', logger());
}
app.use('*', prettyJSON());
app.use('*', secureHeaders());
app.use('*', compress());
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/libs/email.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Database } from '@repo/types';
import type { Tables } from '@repo/types';
import { Resend } from 'resend';
import { supabase } from './supabase.js';

type location = Database['public']['Tables']['ADDRESSES']['Row'];
type user = Database['public']['Tables']['USERS']['Row'];
type location = Tables<'ADDRESSES'>;
type user = Tables<'USERS'>;

async function getApprovedMembers(): Promise<user[] | null> {
const selectedRoles = ['MEMBER'];
Expand Down
6 changes: 3 additions & 3 deletions apps/client/app/ui/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ function LogoutUser() {
Authorization: `Bearer ${localStorage.getItem('access_token')}`,
},
})
.then((response) => {
response.json();
.then(async (response) => {
if (response.status === 200) {
localStorage.removeItem('user');
deleteUserCookie();
localStorage.removeItem('access_token');
await deleteUserCookie();
window.location.href = '/';
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "src/index.ts",
"scripts": {
"clean": "rm -rf node_modules",
"generate:types": "(cd ../../supabase/ && pnpm supabase gen types typescript --local > ../packages/types/src/database.ts) && biome check --write .",
"generate:types": "(cd ../../supabase/ && pnpm supabase gen types --lang=typescript --local > ../packages/types/src/database.ts) && biome check --write .",
"lint": "biome check --write ."
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions packages/types/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2053,6 +2053,10 @@ export type Database = {
updated_at: string;
}[];
};
operation: {
Args: Record<PropertyKey, never>;
Returns: string;
};
search: {
Args: {
prefix: string;
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7bd7b31

Please sign in to comment.