mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
Add logic to "log out of all others".
Consider tablet as desktop device.
This commit is contained in:
parent
a3fa0b0807
commit
69193e9a46
2 changed files with 22 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
import { isDesktop, isMobile, isTablet } from "react-device-detect";
|
||||
|
||||
export const isTouchscreenDevice =
|
||||
isDesktop && !isTablet
|
||||
(isDesktop || isTablet)
|
||||
? false
|
||||
: (typeof window !== "undefined"
|
||||
? navigator.maxTouchPoints > 0
|
||||
|
|
|
@ -182,7 +182,27 @@ export function Sessions() {
|
|||
</div>
|
||||
)
|
||||
})}
|
||||
<Button error>
|
||||
<Button error
|
||||
onClick={async () => {
|
||||
// ! FIXME: add to rAuth
|
||||
let del: string[] = [];
|
||||
render.forEach((session) => {
|
||||
if (deviceId !== session.id) {
|
||||
del.push(session.id);
|
||||
}
|
||||
})
|
||||
|
||||
setDelete(del);
|
||||
|
||||
for (let id of del) {
|
||||
await client.req(
|
||||
"DELETE",
|
||||
`/auth/sessions/${id}` as "/auth/sessions",
|
||||
);
|
||||
}
|
||||
|
||||
setSessions(sessions.filter(x => x.id === deviceId));
|
||||
}}>
|
||||
<Text id="app.settings.pages.sessions.logout" />
|
||||
</Button>
|
||||
<Tip>
|
||||
|
|
Loading…
Reference in a new issue