Skip to content
Snippets Groups Projects
Commit 69193e9a authored by insert's avatar insert
Browse files

Add logic to "log out of all others".

Consider tablet as desktop device.
parent a3fa0b08
No related merge requests found
import { isDesktop, isMobile, isTablet } from "react-device-detect"; import { isDesktop, isMobile, isTablet } from "react-device-detect";
export const isTouchscreenDevice = export const isTouchscreenDevice =
isDesktop && !isTablet (isDesktop || isTablet)
? false ? false
: (typeof window !== "undefined" : (typeof window !== "undefined"
? navigator.maxTouchPoints > 0 ? navigator.maxTouchPoints > 0
......
...@@ -182,7 +182,27 @@ export function Sessions() { ...@@ -182,7 +182,27 @@ export function Sessions() {
</div> </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" /> <Text id="app.settings.pages.sessions.logout" />
</Button> </Button>
<Tip> <Tip>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment