|
|
|
@ -6,8 +6,8 @@ import halfCourt from "../assets/court/half_court.svg"
|
|
|
|
|
import { CourtType } from "../model/tactic/Tactic.ts"
|
|
|
|
|
import { useCallback } from "react"
|
|
|
|
|
import { fetchAPI } from "../Fetcher.ts"
|
|
|
|
|
import { getSession } from "../api/session.ts"
|
|
|
|
|
import { useNavigate } from "react-router-dom"
|
|
|
|
|
import { getSession, saveSession } from "../api/session.ts"
|
|
|
|
|
import { useLocation, useNavigate } from "react-router-dom"
|
|
|
|
|
|
|
|
|
|
export const DEFAULT_TACTIC_NAME = "Nouvelle tactique"
|
|
|
|
|
|
|
|
|
@ -45,6 +45,7 @@ function CourtKindButton({
|
|
|
|
|
courtType: CourtType
|
|
|
|
|
}) {
|
|
|
|
|
const navigate = useNavigate()
|
|
|
|
|
const location = useLocation()
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
@ -65,6 +66,7 @@ function CourtKindButton({
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if (response.status === 401) {
|
|
|
|
|
saveSession({...getSession(), urlTarget: location.pathname})
|
|
|
|
|
// if unauthorized
|
|
|
|
|
navigate("/login")
|
|
|
|
|
return
|
|
|
|
@ -72,7 +74,7 @@ function CourtKindButton({
|
|
|
|
|
|
|
|
|
|
const { id } = await response.json()
|
|
|
|
|
navigate(`/tactic/${id}/edit`)
|
|
|
|
|
}, [courtType, navigate])}>
|
|
|
|
|
}, [courtType, location.pathname, navigate])}>
|
|
|
|
|
<div className="court-kind-button-top">
|
|
|
|
|
<div className="court-kind-button-image-div">
|
|
|
|
|
<img
|
|
|
|
|