Mercurial > public > pacobot
comparison api/store.go @ 10:5c124578fed2
fix timer bug
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sat, 15 Mar 2025 17:03:53 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:228ab74e8321 | 10:5c124578fed2 |
---|---|
1 package api | |
2 | |
3 import ( | |
4 "log" | |
5 "sync" | |
6 ) | |
7 | |
8 var authStore sync.Map | |
9 | |
10 func setAccessToken(accessToken string) { | |
11 authStore.Store("accessToken", accessToken) | |
12 } | |
13 | |
14 func setRefreshToken(refreshToken string) { | |
15 authStore.Store("refreshToken", refreshToken) | |
16 } | |
17 | |
18 func getAccessToken() string { | |
19 value, exists := authStore.Load("accessToken") | |
20 | |
21 if !exists { | |
22 log.Fatal("api: access token not found") | |
23 } | |
24 | |
25 return value.(string) | |
26 } | |
27 | |
28 func getRefreshToken() string { | |
29 value, exists := authStore.Load("refreshToken") | |
30 | |
31 if !exists { | |
32 log.Fatal("api: refresh token not found") | |
33 } | |
34 | |
35 return value.(string) | |
36 } |