diff options
Diffstat (limited to 'frontend/src/api/Auth.ts')
| -rw-r--r-- | frontend/src/api/Auth.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/frontend/src/api/Auth.ts b/frontend/src/api/Auth.ts new file mode 100644 index 0000000..875c7e5 --- /dev/null +++ b/frontend/src/api/Auth.ts | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | import axios from "axios"; | ||
| 2 | import { url } from "@api/Api"; | ||
| 3 | |||
| 4 | export const get_token = async (): Promise<string | undefined> => { | ||
| 5 | const response = await axios.get(url(`token`)) | ||
| 6 | if (!response.data.success) { | ||
| 7 | return undefined; | ||
| 8 | } | ||
| 9 | return response.data.data.token; | ||
| 10 | }; | ||
| 11 | |||
| 12 | export const delete_token = async () => { | ||
| 13 | await axios.delete(url("token")); | ||
| 14 | }; | ||