try to fix rediirect issues
This commit is contained in:
@ -24,7 +24,6 @@ applyAuthTokenInterceptor(axiosInstance, { requestRefresh }); // Notice that th
|
|||||||
// 4. Logging in
|
// 4. Logging in
|
||||||
const login = async (params) => {
|
const login = async (params) => {
|
||||||
const response = await axiosInstance.post('/api/auth/signin', params)
|
const response = await axiosInstance.post('/api/auth/signin', params)
|
||||||
|
|
||||||
// save tokens to storage
|
// save tokens to storage
|
||||||
setAuthTokens({
|
setAuthTokens({
|
||||||
accessToken: response.data.access_token,
|
accessToken: response.data.access_token,
|
||||||
|
@ -31,7 +31,8 @@ const axiosServer = async (context) => {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//redirect to next-auth login page
|
//redirect to next-auth login page
|
||||||
context.res.writeHead(302, { Location: encodeURIComponent('/api/auth/signin') });
|
//context.res.writeHead(302, { Location: encodeURIComponent('/api/auth/signin') });
|
||||||
|
|
||||||
context.res.end();
|
context.res.end();
|
||||||
return { props: {} };
|
return { props: {} };
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user