mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-05-17 03:48:06 +08:00
Switch to JSON webtoken login format
This commit is contained in:
parent
4faf222b52
commit
11c4f0c264
9 changed files with 78 additions and 126 deletions
|
@ -8,12 +8,14 @@ export const AuthSlice = createSlice({
|
|||
uid: "",
|
||||
username: "",
|
||||
full_name: "",
|
||||
token: "",
|
||||
refresh_token: "",
|
||||
access_token: "",
|
||||
},
|
||||
},
|
||||
reducers: {
|
||||
setToken: (state, action) => {
|
||||
state.creds.token = action.payload;
|
||||
state.creds.access_token = action.payload.access_token;
|
||||
state.creds.refresh_token = action.payload.refresh_token;
|
||||
},
|
||||
setUser: (state, action) => {
|
||||
state.creds = {
|
||||
|
@ -21,7 +23,8 @@ export const AuthSlice = createSlice({
|
|||
uid: action.payload.uid,
|
||||
username: action.payload.username,
|
||||
full_name: action.payload.full_name,
|
||||
token: action.payload.token,
|
||||
access_token: action.payload.access_token,
|
||||
refresh_token: action.payload.refresh_token,
|
||||
};
|
||||
},
|
||||
clear: (state) => {
|
||||
|
@ -30,7 +33,8 @@ export const AuthSlice = createSlice({
|
|||
uid: "",
|
||||
username: "",
|
||||
full_name: "",
|
||||
token: "",
|
||||
refresh_token: "",
|
||||
access_token: "",
|
||||
};
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue