Skip to content

Commit

Permalink
whattheduck: Clear socket cache on logout
Browse files Browse the repository at this point in the history
  • Loading branch information
bperel committed Sep 2, 2024
1 parent b9c5c8e commit 7db224a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion apps/whattheduck/src/stores/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export const app = defineStore('app', () => {
watch(
() => route.hash,
(newValue) => {
if (route.name !== 'Collection') {
return;
}
const parts = newValue
.replace(/^#(coa-)?/, '')
.replaceAll('_', ' ')
Expand Down Expand Up @@ -195,7 +198,7 @@ export const app = defineStore('app', () => {
} else {
await router.push({
name: 'Collection',
hash: hash,
hash,
});
}
});
Expand Down
6 changes: 5 additions & 1 deletion apps/whattheduck/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ const submitLogin = async () => {
}
};
if (!token.value) {
injectLocal<Storage>('storage')!.clear();
}
watch(
token,
() => {
if (token.value) {
window.location.replace('/collection');
router.push('/collection#all=all');
}
},
{ immediate: true },
Expand Down
1 change: 1 addition & 0 deletions packages/api/services/login/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default (io: Server) => {

socket.on("getCsrf", (callback) => callback(""));
socket.on("login", async ({ username, password }, callback) => {
console.log("login");
const hashedPassword = getHashedPassword(password);
const user = await prismaDm.user.findFirst({
where: {
Expand Down

0 comments on commit 7db224a

Please sign in to comment.